#include <bits/stdc++.h>
using namespace std;
const int maxn = 200020;
int position[maxn], cl[maxn], cr[maxn], ans[maxn];
int n, k, flag = 1;
void del(int pos) {
  int l = pos, r = pos;
  for (int i = 0; i <= k; i++) {
    ans[l] = ans[r] = flag;
    l = cl[l];
    r = cr[r];
  }
  cr[l] = r;
  cl[r] = l;
  flag = flag % 2 + 1;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    cl[i] = i - 1;
    cr[i] = i + 1;
    position[x] = i;
  }
  cr[n + 1] = n + 1;
  int cur = n;
  while (cur) {
    while (cur && ans[position[cur]]) cur--;
    del(position[cur]);
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i];
  }
  return 0;
}
