#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int maxn = 2e5 + 5;
int n, k;
bool vis[maxn];
int a[maxn], out[maxn];
int prv[maxn], nxt[maxn];
int main() {
  scanf("%d%d", &n, &k);
  priority_queue<pair<int, int> > pq;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    pq.push({a[i], i});
    prv[i] = i - 1;
    nxt[i] = i + 1;
  }
  bool fen = 1;
  while (pq.size()) {
    int val = pq.top().first;
    int idx = pq.top().second;
    pq.pop();
    if (vis[idx]) continue;
    fen = !fen;
    vis[idx] = true;
    out[idx] = fen + 1;
    int len = k, awl = nxt[idx], tani = prv[idx];
    while (len-- && awl <= n) {
      vis[awl] = true;
      out[awl] = fen + 1;
      awl = nxt[awl];
    }
    len = k;
    while (len-- && tani > 0) {
      vis[tani] = true;
      out[tani] = fen + 1;
      tani = prv[tani];
    }
    nxt[tani] = awl;
    prv[awl] = tani;
  }
  for (int i = 1; i <= n; ++i) printf("%d", out[i]);
  return 0;
}
