#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<int> slova(k,0);
    for(int i = 0; i < n; i++){
        slova[s[i]-'a']++;
        cout << *min_element(slova.begin(), slova.end())+1 << " ";

    }
    return 0;
}