#include <bits\stdc++.h>
using namespace std;

char a[100000];
string eng = "abcdefghijklmnopqrstuvwxyz", perm = eng;
int n, k, nsize = 2;

bool Found(int size, int r){
	int i = 0;
	for(int j = 0; j < r; j++){
		while(a[j+i] == perm[i]){
			if(i == size)return true;
			i++;
		}
		i = 0;
	}
	return false;
}


void Search(int r){
	while(Found(nsize-1, r-nsize+1)){
		if(!next_permutation(perm.begin(), perm.begin()+k)){
			nsize++;
			perm = eng;
		}
	}
	
	cout << nsize << ' ';
	return;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int i, j = 1;
	cin >> n >> k;
	for(i = 0; i < n; i++){
		cin >> a[i];
	}
	
	while(j < k){
		for(int p = k-1; p >= 0; p--){
			for(i = 0; i < j; i++){
				if(a[i] == eng[p])break;
			}
			if(i == j){
				cout << 1 << ' ';
				break;
			}
		}
		j++;
	}
	
	for(i = j; i <= n; i++){
		Search(i);
	}
	
	return 0;
}