#include <bits/stdc++.h>

using namespace std;

string niz;
long long cycles[5000][28];
long long countCycle;
long long finishedCycles;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    long long n, k;
    cin >> n >> k;
    cin >> niz;
    for(int i = 0; i < n; i++) {
        if(cycles[finishedCycles][niz[i] - 'a'] == 0) {
            cycles[finishedCycles][niz[i] - 'a'] = 1;
            countCycle++;
            if(countCycle == k) {
                finishedCycles++;
                countCycle = 0;
            }
        }
        cout << finishedCycles + 1 << " ";
    }
    cout << endl;
    return 0;
}