int main() {
int n, k;
cin >> n >> k;
int a[n];
forn(i, n)
cin >> a[i];
// r ---> max l [l..r]
int l = 0, diff = 0;
unordered_map <int, int> cnt; // cnt[x] -- сколько раз
forn(r, n) {
if (!cnt[r]++)
diff++;
while (diff >= k)
if (!--cnt[l])
diff--;
// l(r) -- min : diff < k
// left = [0..l)
// sum[left..r] = sum[r+1] - sum[left]
}
}