#include <bits/stdc++.h>
using namespace std;
const int N = 200004;
int n, K, a[N], nx[N], ans[N], pre[N], type = 2;
priority_queue<pair<int, int> > q;
int main() {
  scanf("%d%d", &n, &K);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    q.push(pair<int, int>(a[i], i));
    nx[i] = i + 1;
    pre[i] = i - 1;
  }
  while (!q.empty()) {
    type = 3 - type;
    pair<int, int> keep = q.top();
    q.pop();
    int id = keep.second, t1, t2;
    ans[id] = type;
    int d = 0;
    int x = nx[id];
    while (d < K && x <= n) {
      ans[x] = type;
      d++;
      x = nx[x];
    }
    t2 = x;
    x = pre[id];
    d = 0;
    while (d < K && x >= 1) {
      ans[x] = type;
      d++;
      x = pre[x];
    }
    t1 = x;
    nx[t1] = t2;
    pre[t2] = t1;
    while (!q.empty() && ans[q.top().second] != 0) q.pop();
  }
  for (int i = 1; i <= n; i++) printf("%d", ans[i]);
}
