#include <bits/stdc++.h>

using namespace std;

vector<int> b[26];
int low(int x, char k) {
    return (lower_bound(b[k-'a'].begin(), b[k-'a'].end(), x) == b[k-'a'].end() ?
            (int)1e6 : *lower_bound(b[k-'a'].begin(), b[k-'a'].end(), x));
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int dp[n], l[n];
    fill(l, l+n, 0);
    for (int i = 0; i < n; ++i) {
        b[s[i] - 'a'].push_back(i);
    }
    for (int j = 0; j < k; ++j) {
        l[0] = max(l[0], low(0, 'a' + j));
    }
    dp[0] = 1;
    cout << dp[0] << ' ';
    for (int i = 1; i < n; ++i) {
        if (l[i-1] != i) {
            dp[i] = dp[i-1], l[i] = l[i-1];
        }
        else {
            for (int j = 0; j < k; ++j) {
                l[i] = max(l[i], low(i+1, 'a' + j));
            }
            dp[i] = dp[i-1] + 1;
        }
        cout << dp[i] << ' ';
    }
    cout << '\n';
    return 0;
}