#include using namespace std; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int N, M; cin >> N >> M; vector A(N); for(int i = 0; i < N; i++) cin >> A[i]; if(M == 0) { for(int w = 1; w <= N; w++) { cout << N - w + 1 << '\n'; } return 0; } int j = 0; set st; for(int i = 0; i <= M + 10; i++) st.insert(i); map freq; vector thr(N, -1); for(int i = 0; i < N; i++) { while (j < N && *st.lower_bound(0) < M) { freq[A[j]]++; st.erase(A[j]); j++; } thr[i] = *st.lower_bound(0) >= M ? j: -1; if(--freq[A[i]] == 0) st.insert(A[i]); } vector ans(N + 2); for(int i = 0; i < N; i++) { int j = thr[i]; if(j == -1) continue; ans[j - i]++; ans[N - i + 1]--; } for(int i = 1; i <= N; i++) ans[i] += ans[i - 1]; for(int i = 1; i <= N; i++) cout << ans[i] << '\n'; }