#include <bits/stdc++.h>

#define int long long

#define pb push_back

const int N = 2e5 + 10;

const int inf = 2e9;

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    s = '.' + s;
    vector<int>cnt(26,0);
    for(int i = 1; i <= n; i++) {
        cnt[s[i] - 'a'] += 1;
        int mn = inf;
        for(int j = 0; j < k; j++) {
            mn = min(mn,cnt[j]);
        }
        cout << mn + 1 << " ";
    }
    return 0;
}