#include<bits/stdc++.h>
using namespace std;
char rec[200050];
int niz[35];
int mini;
int n,k;
char pos;
int main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("test.in", "r", stdin);
    //freopen("test1.izlaz", "w", stdout);
    cin >> n >> k;

    for(int i=1; i<=n; i++)
    {
        cin >> rec[i];
        niz[int(rec[i]) - 96]++;
        mini = 1e9;
        for(int j = 1; j<=k; j++)
        {
            //cout << niz[j] << " ";
            mini = min(mini, niz[j]);
        }
        // << endl;
        cout << mini+1 << " ";
        //cout << endl;
    }
    cout << "\n";
    return 0;
}
///NE RADI
/*
5
2
aaaab

*/