#include <bits/stdc++.h>
using namespace std;
long long n, k;
int res[200005];
struct data {
  long long val, pos;
} a[200005];
struct linkList {
  int L, R;
} Link[200005];
bool cmp(data x, data y) { return x.val > y.val; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i].val;
    a[i].pos = i;
    Link[i].L = i - 1;
    Link[i].R = i + 1;
  }
  sort(a + 1, a + n + 1, cmp);
  int turn = 2;
  for (int i = 1; i <= n; ++i) {
    if (!res[a[i].pos]) {
      turn = 3 - turn;
      int pos = a[i].pos;
      int posL, posR;
      res[pos] = turn;
      for (int j = 1; j <= k; ++j) {
        if (Link[pos].L == 0) break;
        pos = Link[pos].L;
        res[pos] = turn;
      }
      posL = pos;
      pos = a[i].pos;
      for (int j = 1; j <= k; ++j) {
        if (Link[pos].R == n + 1) break;
        pos = Link[pos].R;
        res[pos] = turn;
      }
      posR = pos;
      Link[Link[posR].R].L = Link[posL].L;
      Link[Link[posL].L].R = Link[posR].R;
    }
  }
  for (int i = 1; i <= n; ++i) cout << res[i];
}
