#include <bits/stdc++.h>
using namespace std;
int n, k, timee = 2, a[200100], fim[200100], com[200100], team[200100],
          id[200100];
set<int> s;
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), id[a[i]] = i, s.insert(a[i]);
  for (int at = n; at >= 1; at--) {
    if (team[id[at]] != 0) continue;
    int st = 0, nd = n;
    timee = (timee == 2 ? 1 : 2);
    team[id[at]] = timee;
    for (int i = id[at] + 1, aux = k; i <= n && aux > 0; aux--, i++) {
      while (team[i] != 0 && i <= n) i = fim[i];
      team[i] = timee;
      nd = i;
    }
    for (int i = id[at] - 1, aux = k; i >= 1 && aux > 0; aux--, i--) {
      while (team[i] != 0 && i >= 1) i = com[i];
      team[i] = timee;
      st = i;
    }
    fim[st] = nd + 1;
    com[nd] = st - 1;
  }
  for (int i = 1; i <= n; i++) printf("%d", team[i]);
}
