#include <bits/stdc++.h>
using namespace std;
#include <atcoder/modint>
using namespace atcoder;
#ifdef DEFINED_ONLY_IN_LOCAL
#include <dump.hpp>
#define dump(...) cpp_dump(__VA_ARGS__)
#else
#undef dump
#define dump(...)
#endif
#define rep(i, n) for (int i = 0; i < n; i++)
template <class T> istream& operator>>(istream& I, vector<T>& V) { for (T& X : V) I >> X; return I; }

int main() {
    int n, m, mx = 200100;
    cin >> n >> m;
    vector<int> a(n);
    cin >> a;
    if (m == 0) {
        for (int i = 1; i <= n; i++) {
            cout << n - i + 1 << endl;
        }
        return 0;
    }
    vector<int> cnt(mx);
    int r = 0, b = m;
    vector<int> s(n + 10);
    rep(l, n) {
        while (r < n and b > 0) {
            if (cnt[a[r]] == 0 and a[r] < m) {
                b--;
            }
            cnt[a[r]]++;
            r++;
        }
        int len = r - l;
        if (b == 0) {
            s[len]++;
            s[n - l + 1]--;
        }
        if (cnt[a[l]] == 1 and a[l] < m) {
            b++;
        }
        cnt[a[l]]--;
    }
    for (int i = 1; i <= n; i++) {
        s[i] += s[i - 1];
        cout << s[i] << endl;
    }
    return 0;
}