#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return f * x;
}
const int N = 200005;
int n, k;
int p[N], c[N];
int pre[N], nxt[N];
int flag;
int main() {
  priority_queue<pair<int, int> > q, v;
  n = read();
  k = read();
  for (int i = 1; i <= n; ++i) {
    p[i] = read();
    q.push(pair<int, int>(p[i], i));
    pre[i] = i - 1;
    nxt[i] = i + 1;
  }
  while (!q.empty()) {
    while (!v.empty() && q.top() == v.top()) {
      q.pop();
      v.pop();
    }
    if (q.empty()) break;
    int u = q.top().second;
    c[u] = flag + 1;
    int i, j, cnt;
    for (i = pre[u], cnt = 1; cnt <= k && i >= 1; i = pre[i], ++cnt) {
      c[i] = flag + 1;
      v.push(pair<int, int>(p[i], i));
    }
    for (j = nxt[u], cnt = 1; cnt <= k && j <= n; j = nxt[j], ++cnt) {
      c[j] = flag + 1;
      v.push(pair<int, int>(p[j], j));
    }
    nxt[i] = j;
    pre[j] = i;
    flag ^= 1;
    q.pop();
  }
  for (int i = 1; i <= n; ++i) printf("%d", c[i]);
  return 0;
}
