#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K, ar[200005], mark[200005], ans[200005], woah[200005][2];
  scanf("%d %d", &N, &K);
  memset(ans, -1, sizeof(ans));
  memset(woah, -1, sizeof(woah));
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &ar[i]);
    mark[ar[i]] = i;
  }
  int fl = 2;
  for (int i = N; i >= 1; --i) {
    int pos = mark[i];
    if (ans[pos] == -1) {
      if (fl == 2) {
        fl = 1;
      } else {
        fl = 2;
      }
      ans[pos] = fl;
      int rpos = pos + 1;
      for (int j = 0; j < K; ++j) {
        if (rpos > N) {
          break;
        }
        if (ans[rpos] != -1) {
          rpos = woah[rpos][0] + 1;
          --j;
        } else {
          ans[rpos] = fl;
          ++rpos;
        }
      }
      int lpos = pos - 1;
      for (int j = 0; j < K; ++j) {
        if (lpos < 1) {
          break;
        }
        if (ans[lpos] != -1) {
          lpos = woah[lpos][1] - 1;
          --j;
        } else {
          ans[lpos] = fl;
          --lpos;
        }
      }
      ++lpos;
      --rpos;
      woah[lpos][0] = rpos;
      woah[rpos][1] = lpos;
    }
  }
  for (int i = 1; i <= N; ++i) {
    printf("%d", ans[i]);
  }
  return 0;
}
