#include <bits/stdc++.h>
using namespace std;
int le[200005];
int ri[200005];
int ar[200005];
int ans[200005];
priority_queue<pair<int, int> > pq;
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    le[i] = ri[i] = i;
    scanf("%d", &ar[i]);
    pq.push(pair<int, int>(ar[i], i));
  }
  int mov = 0;
  while (!pq.empty()) {
    int x = pq.top().second;
    pq.pop();
    if (ans[x] != 0) continue;
    ans[x] = mov + 1;
    int L = x, R = x;
    for (int i = x + 1, j = k; j && i < n; i++) {
      i = ri[i];
      if (ans[i] == 0) {
        ans[i] = mov + 1;
        j--;
      }
      R = i;
    }
    for (int i = x - 1, j = k; j && i >= 0; i--) {
      i = le[i];
      if (ans[i] == 0) {
        ans[i] = mov + 1;
        j--;
      }
      L = i;
    }
    ri[L] = R;
    le[R] = L;
    mov ^= 1;
  }
  for (int i = 0; i < n || (printf("\n") && 0); i++) {
    printf("%d", ans[i]);
  }
  return 0;
}
