#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using str = string;

using vi = vector<int>;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)


void solve(){
    int n, k, l, sol = 1;
    cin >> n >> k;
    str s;
    cin >> s;
    vi v(k);
    l = k;
    F0R(i, n){
        int x = s[i] - 'a';
        if(v[x] < sol){
            v[x] ++;
            l--;
        }
        if(l == 0){
            sol++;
            l = k;
        }
        cout << sol << " ";
    }

}


int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t; t = 1;while(t--){
        solve();
    }
    return 0;
}