from collections import Counter from itertools import accumulate 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() imos = [0] * (N + 2) 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: imos[r - l] += 1 imos[N - l + 1] -= 1 cntr[A[l]] -= 1 if cntr[A[l]] == 0 and A[l] < M: not_exist.add(A[l]) imos = list(accumulate(imos)) for i in range(1, N + 1): print(imos[i])