#include <iostream>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define cy cout << "YES" << endl;
#define cn cout << "NO" << endl;
#define pf push_front
#define pb push_back
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vll vector<ll>
#define print(x) cout << x << endl;
#define prints(x) cout << x << ' ';

void solve()
{
    int n,k; cin >> n >> k;
    string s; cin >> s;
    vi cntSlova(k,0);

    for(int i = 0; i < s.length(); i++)
    {
        cntSlova[s[i] - 'a']++;

        int mn = 30;
        for(int j = 0; j < k; j++)
            mn = min(mn, cntSlova[j]);
        cout << mn + 1 << endl;
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int tt= 1;
    while(tt--)
    {
        solve();
    }
}