#include <bits/stdc++.h>

using namespace std;

char niz[100005];
int cycles[3847][26];
bool active[26];
int countCycle;
int finishedCycles;

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