//#include #include using namespace std; typedef long long ll; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() const int MAX = 1e9; const int MIN = -1*1e9; const ll MAXLL = 1e18; const ll MINLL = -1*1e18; int main() { int N,M; cin >> N >> M; if(M == 0) { for(int i = 0; i < N; i++) cout << N-i << endl; return 0; } M--; vector V(N); for(int i = 0; i < N; i++) cin >> V[i]; vector Count(M+1),Ans(N+2); set S; int r = 0; for(int l = 0; l < N; l++) { if(l) { Count[V[l-1]]--; if(Count[V[l-1]] == 0) S.erase(V[l-1]); } while(S.size() <= M) { if(r == N) break; Count[V[r]]++; if(Count[V[r]] == 1 && V[r] <= M) S.insert(V[r]); r++; } if(S.size() <= M) continue; Ans[r-l]++; Ans[N-l+1]--; } for(int i = 1; i <= N; i++) { Ans[i+1] += Ans[i]; cout << Ans[i] << endl; } return 0; }