#include <bits/stdc++.h>
using namespace std;

const int N = 2e5 + 3;
const int inf = 1e9;
const int B = 27;
int freq[B];

void solve() {
    int n, k; cin >> n >> k;
    string s; cin >> s;
    s = " " + s;
    for (int i = 1; i <= n; i++) {
        freq[s[i] - 'a']++;
        int mn = inf;
        for (int j = 0; j < k; j++)
            mn = min(mn, freq[j]);
        cout << mn+1 << " ";
    }
    cout << "\n";
}

int main() {
    int t=1; //cin >> t;
    while (t--) {
        solve();
    }
}