#include<bits/stdc++.h>

using namespace std;

#define int long long

void solve(){
    int n, k;cin>>n>>k;
    string s;cin>>s;
    map<char, bool> m;
    vector<int> d(n);
    int cur = 1;
    int r = 0;
    for(int i = 0;i<n;i++){
        if(!m[s[i]]){
            r++;
            m[s[i]] = true;
        }
        if(r==k){
            m.clear();
            r = 0;
            cur++;
        }
        d[i] = cur;
    }
    for(int i = 0;i<n;i++) cout<<d[i]<<" ";
    cout<<endl;
    return;
}

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