#include <bits/stdc++.h>
using namespace std;
int n, k, p[200005];
int vis[200005], cntn;
int pre[200005], nxt[200005];
int flag = 0;
struct node {
  int p, s;
  node(int p = 0, int s = 0) : p(p), s(s) {}
  bool operator<(const node &b) const { return p < b.p; }
};
void del(int x) {
  nxt[pre[x]] = nxt[x];
  pre[nxt[x]] = pre[x];
  vis[x] = flag + 1;
  cntn--;
}
priority_queue<node> q;
int main() {
  cin >> n >> k;
  cntn = n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i]);
    pre[i] = i - 1;
    nxt[i] = i + 1;
    q.push(node(p[i], i));
  }
  while (cntn) {
    while (vis[q.top().s] != 0) q.pop();
    node t = q.top();
    q.pop();
    del(t.s);
    int cur = pre[t.s];
    for (int i = 0; i < k && cur != 0; i++, cur = pre[cur]) del(cur);
    cur = nxt[t.s];
    for (int i = 0; i < k && cur != n + 1; i++, cur = nxt[cur]) del(cur);
    flag = 1 - flag;
  }
  for (int i = 1; i <= n; i++) cout << vis[i];
  return 0;
}
