#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;
    vector<int> a(26, 0);
    for (char c : s)
    {
        a[c - 'a']++;
        cout << 1 + *min_element(a.begin(), a.begin() + k) << " ";
    }
}