#include <iostream>
using namespace std;

int sum[26][200001];
int main()
{
    int n, k;
    scanf("%d %d", &n, &k);
    char s[n+1];
    scanf("%s", s);

    sum[s[0]-'a'][0] = 1;
    for (int i=1; i<n; i++) {
        for (int j=0; j<k; j++) {
            if (s[i]-'a' == j) sum[j][i] = sum[j][i-1]+1;
            else sum[j][i] = sum[j][i-1];
        }
    }

    for (int i=0; i<n; i++) {
        // podniska [0, i]
        int minC = 2000002, c;
        for (int j=0; j<k; j++) {
            c = sum[j][i] - sum[j][0];
            if (sum[j][0] == 1) c++;
            if (c < minC) minC = c;
        }
        printf("%d ", c+1);
    }
    return 0;
}