#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 5;
struct stu {
  int x, p;
} d[N];
bool cmp(stu a, stu b) { return a.x > b.x; }
int c[N], nexx[N], pre[N], vis[N], ans[N];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
    d[i].x = c[i];
    d[i].p = i;
    nexx[i] = i + 1;
    pre[i] = i - 1;
  }
  sort(d + 1, d + 1 + n, cmp);
  int f = 2;
  for (int i = 1; i <= n; i++) {
    int x = d[i].p;
    if (vis[x]) continue;
    f = f == 1 ? 2 : 1;
    vis[x] = 1;
    ans[x] = f;
    int p = k, l = pre[x], r = nexx[x];
    while (l != 0 && p > 0) {
      vis[l] = 1;
      ans[l] = f;
      l = pre[l];
      p--;
    }
    p = k;
    while (r != n + 1 && p > 0) {
      vis[r] = 1;
      ans[r] = f;
      r = nexx[r];
      p--;
    }
    nexx[l] = r;
    pre[r] = l;
  }
  for (int i = 1; i <= n; i++) cout << ans[i];
  return 0;
}
