n, m = map(int, input().split()) a = list(map(int, input().split())) if m==0: for i in range(n): print(n-i) exit() tmp = [0]*(n+1) cnt = [0]*(m+2) d = set() r = 0 for i in range(n): while len(d) < m and r < n: if a[r] < m: cnt[a[r]] += 1 d.add(a[r]) r += 1 if len(d) == m: tmp[r-i-1] += 1 tmp[n-i] -= 1 if a[i] < m: cnt[a[i]] -= 1 if cnt[a[i]] == 0: d.discard(a[i]) import itertools acc = list(itertools.accumulate(tmp)) print(*acc[:-1], sep='\n')