#include <bits/stdc++.h>
#define STEF ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define nl '\n'
int MOD =1000000007;
using namespace std;


int main(){
	STEF;
    ll n,k;cin>>n>>k;
    string s;cin>>s;
    unordered_map<char,ll>m;
    for(int i=0;i<n;i++){
        m[s[i]]++;
        ll minn=LLONG_MIN;
        ll b=m[s[0]];
        bool g=true;
        for(auto it=m.begin();it!=m.end();it++){
            if(b!=it->S){
               g=false;
            }
            minn=max(minn,it->S);
        }
        if(g && m.size()>2){
            minn++;
        }
        cout<<minn<<" ";
    }
	return 0;
}