#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>l(26,inf),r(26,0),cnt(26,0);
    for(int i = 1; i <= n; i++) {
        cnt[s[i] - 'a'] += 1;
        int mn = inf;
        l[s[i] - 'a'] = min(l[s[i] - 'a'],i);
        r[s[i] - 'a'] = i;
        for(int j = 0; j < k; j++) {
            mn = min(mn,cnt[j]);
        }
        if(!mn) {
            cout << 1 << " ";
            continue;
        }
        bool ok = false;
        for(int i = 0; i < k; i++) {
            for(int j = 0; j < k; j++) {
                if(i == j) continue;
                if(l[i] < r[j]) continue;
                ok = true;
            }
        }
        int res = 3;
        if(ok) res = 2;
        res = min(res,mn + 1);
        cout << res << " ";
    }
    return 0;
}