#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, k; cin >> n >> k;
    string s; cin >> s;

    int niz[26] = {0};
    for (char c : s)
    {
        niz[c-'a']++;
        int mn = niz[0];
        for (int i = 1; i < k; i++)
        {
            mn = min(mn, niz[i]);
        }
        cout << min(2,mn + 1) << endl;
    }
}