from collections import Counter # 双対BIT class Dual_Fenwick_Tree: def __init__(self, n): self._n = n self.data = [0] * n # l 以上 r 未満の区間に x を加算する def prod(self, l, r, x): self._add(l, x) if r < self._n: self._add(r, -x) # 添え字 p の値を返す def get(self, p): return self._sum(p + 1) - self._sum(0) def _add(self, p, x): p += 1 while p <= self._n: self.data[p - 1] += x p += p & -p def _sum(self, r): s = 0 while r > 0: s += self.data[r - 1] r -= r & -r return s N, M = map(int, input().split()) if M == 0: for i in range(1, N + 1): print(N - i + 1) exit() A = list(map(int, input().split())) not_exist = set([*range(0, M)]) cntr = Counter() dual_bit = Dual_Fenwick_Tree(N + 1) r = 0 for l in range(N): while r < N and len(not_exist) >= 1: cntr[A[r]] += 1 not_exist.discard(A[r]) r += 1 if len(not_exist) == 0: dual_bit.prod(r - l, N - l + 1, 1) cntr[A[l]] -= 1 if cntr[A[l]] == 0 and A[l] < M: not_exist.add(A[l]) l += 1 for i in range(1, N + 1): print(dual_bit.get(i))