#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int maxn = 2e5 + 9;
const long long inf = 1e16;
const long long mod = 1e9 + 7;
int op[maxn], last[maxn], nextp[maxn];
int vis[maxn], pq[maxn];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> op[i];
    vis[op[i]] = i;
    nextp[i] = i + 1;
    last[i] = i - 1;
  }
  int pos = n;
  int fg = 1;
  while (pos) {
    while (pos && !vis[pos]) --pos;
    if (!pos) break;
    pq[vis[pos]] = fg;
    int s, t;
    int tmp = vis[pos];
    for (int i = 0; i < k; ++i) {
      tmp = nextp[tmp];
      t = tmp;
      if (tmp > n) break;
      pq[tmp] = fg;
      vis[op[tmp]] = 0;
    }
    tmp = vis[pos];
    for (int i = 0; i < k; ++i) {
      tmp = last[tmp];
      s = tmp;
      if (tmp <= 0) break;
      pq[tmp] = fg;
      vis[op[tmp]] = 0;
    }
    vis[pos] = 0;
    if (fg == 1)
      fg = 2;
    else
      fg = 1;
    if (t < n && nextp[t] <= n) {
      if (s >= 1)
        last[nextp[t]] = last[s];
      else
        last[nextp[t]] = s;
    }
    if (s > 1 && last[s] >= 1) {
      if (t <= n)
        nextp[last[s]] = nextp[t];
      else
        nextp[last[s]] = t;
    }
  }
  for (int i = 1; i <= n; ++i) cout << pq[i];
  return 0;
}
