#include <bits/stdc++.h>
using namespace std;
int nxt[200008], bef[200008], val[200008];
int n, k;
int pos[200008];
int ans[200008];
void del(int x, int y) {
  pos[val[x]] = 0;
  ans[x] = y;
  nxt[bef[x]] = nxt[x], bef[nxt[x]] = bef[x];
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++)
    scanf("%d", &val[i]), nxt[i] = i + 1, bef[i] = i - 1, pos[val[i]] = i;
  nxt[0] = 1, bef[n + 1] = n;
  bef[0] = 0, nxt[n + 1] = n + 1;
  int tim = n;
  int now = 1;
  while (tim) {
    if (pos[tim]) {
      vector<int> v;
      int x = pos[tim];
      for (int i = 0; i < k; i++) x = bef[x], v.push_back(x);
      x = pos[tim];
      for (int i = 0; i < k; i++) x = nxt[x], v.push_back(x);
      x = pos[tim];
      v.push_back(x);
      for (int i = 0; i < v.size(); i++)
        if (v[i] >= 1 and v[i] <= n) del(v[i], now);
      now ^= 3;
    }
    --tim;
  }
  for (int i = 1; i <= n; i++) printf("%d", ans[i]);
  return 0;
}
