#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, k; cin>>n>>k;
    
    if(k==2 && n<=5){
    
    char last; cin>>last;

    int sw=0, a=0, b=0;

    if(last=='a'){
        a++;
    }
    else{
        b++;
    }

    cout<<1<<" ";

    for(int i=0; i<n-1; i++){
        char x; cin>>x;

        if(x=='a'){a++;}
        if(x=='b'){b++;}
        if(x!=last){
            sw++;
            last=x;
        }
        if(a==0 || b==0){
            cout<<1<<" ";
        }
        else if(sw>=2 && a>=2 && b>=2){
            cout<<3<<" ";
        }
        else{
            cout<<2<<" ";
        }
    }
    
    }
    
    else{
            
    int s=1;
    char last; cin>>last;

    cout<<1<<" ";

    for(int i=0; i<n-1; i++){
        char x; cin>>x;

        if(x!=last){
            last = x;
            s++;
        }
        if(s==k){
            cout<<2<<" ";
        }
        else{
            cout<<1<<" ";
        }
    }
    
    }

    return 0;
}