#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
const int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
int n;
int v[N];
int val[N];
int team[N];
int vizdir[N];
int vizesq[N];
set<int> maior;
void dfs(int x, int t, int k, int s = 6) {
  team[x] = t;
  maior.erase(v[x]);
  int viz1 = vizdir[x];
  int viz0 = vizesq[x];
  if (viz0 != -1 && viz0 != n) vizdir[viz0] = viz1;
  if (viz1 != -1 && viz1 != n) vizesq[viz1] = viz0;
  if (s % 3 == 0 && vizdir[x] < n && !team[vizdir[x]] && k > 0)
    dfs(vizdir[x], t, k - 1, 3);
  if (s % 2 == 0 && vizesq[x] >= 0 && !team[vizesq[x]] && k > 0)
    dfs(vizesq[x], t, k - 1, 2);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    maior.insert(i + 1);
    cin >> v[i];
    val[v[i]] = i;
    vizesq[i] = i - 1;
    vizdir[i] = i + 1;
  }
  int t = 1;
  while (maior.size() > 0) {
    set<int>::iterator it = maior.end();
    --it;
    int aux = *it;
    dfs(val[aux], t, k);
    t = 3 - t;
  }
  for (int i = 0; i < n; i++) {
    cout << team[i];
  }
  cout << "\n";
}
