#include <iostream>
using namespace std;

int c[26];
int main()
{
    int n, k;
    scanf("%d %d", &n, &k);
    char s[n+1];
    scanf("%s", s);
    int sum = 1;
    for (int i=0; i<n; i++) {
        int countOpen = 0;
        c[s[i]-'a'] = 1;
        for (int j=0; j<k; j++) {
            countOpen += c[j];
        }
        if (countOpen == k) {
            // novi ciklus, reset
            for (int j=0; j<k; j++) {
                c[j] = 0;
            }
            printf("%d ", ++sum);
        } else printf("%d ", sum);
    }
    return 0;
}

/*
9 3
aaabaccbc
*/