#include <iostream>
#include <string>
#include <vector>
#include <map>
using namespace std;

void function(map<char, int> m, map<char, int> k, vector<char> c, int n, map<char, int> p, int K){
	for(int i = 0; i < n; i++){
		map<char, bool> o;
		int r = 0;
		for(int j = k[c[i]]; j < p[c[i]]; j++){
			if(o[c[i]] == false){
			r++;
		}
		o[c[i]] = true;
		}
		if(r != K){
			cout<<"2 ";
			K = -1;
			break;
		}
	}
	if(K != -1){
		cout<<"3 ";
	}
}
int main(){
	int N, K;
	cin>>N>>K;
	vector<char> c(N);
	map<char, int> m;
	map<char, int> k;
	map<char, int> p;
	for(int i = 0; i < N; i++){
		cin>>c[i];
		m[c[i]] = 0;
		k[c[i]] = -1;
		p[c[i]] = -1;
	}
	int r = N;
	for(int i = 0; i < N; i++){
		if(r > 0){
			cout<<"1 ";
		}
		else
		if(p[c[i]] == -1){
			cout<<"2 ";
		}
		else{
			function(m, k, c, N, p, K);
		}
		if(m[c[i]] == 0){
			r--;
		}
		m[c[i]] += 1;
		if(k[c[i]] == -1){
		k[c[i]] = i;
	}
	else{
		p[c[i]] = i;
	}
	}
}