#include <bits/stdc++.h>
#define pb push_back

using namespace std;

//map<int , int>mapa;
int n , k;
vector<int>v1;

vector<int>ve(0 , 0);

void povecaj(int br){
    if (br >= ve.size()){
        ve.pb(1);
        for (int i = 0; i<ve.size(); i++){
            ve[i] = 1;
        }
    }else if (ve[br] == k){
        ve[br] = 1;
        povecaj(br+1);
    }else {
        ve[br]++;
    }



    return;
}

bool provera(int & maks){
    int br = 0 , x = 0;
    for (int j = 0; j<ve.size(); j++){
        for (int i = x; i<=maks; i++){
            if (v1[i] == ve[j]){
                x = i+1;
                br++;
                break;
            }
        }
    }
    return !(br == ve.size());
}

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

    cin>>n>>k;

    char c;
    for (int i = 0; i<n; i++){
        cin>>c;
        v1.pb(c-96);
    }
    ve.pb(1);
    for(int i = 0; i<n; i++){
        while (!provera(i)){
            povecaj(0);
        }
        /*for (int j = 0; j<ve.size(); j++){
            cout<<ve[j]<<" ";
        }
        cout<<"\n";*/

        cout<<ve.size()<<" ";
    }
}