#include <bits/stdc++.h>

using namespace std;
int main()
{
    vector< vector<int> > v;
    int n, k; cin >> n >> k;
    string s; cin >> s;
    v.resize(n);
    for(int i = 0; i < n; i++){
        v[i].resize(k);
    }
    int b = 1;
    for(int i = 0; i < n; i++){
        if(i > 0) v[i] = v[i-1];
        v[i][s[i]-'a']++;
        bool c = true;
        int k = v[i][0];
        for(int j = 1; j < v[i].size(); j++){
            if(v[i][j] != k) c = false;
        }
        if(c) b++;
        cout << b << " ";
    }
    return 0;
}