#include <bits/stdc++.h>
using namespace std;
int n, k, cnt, p, ans[200010], a[200010], pre[200010], nex[200010], pos[200010];
set<int> s;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pre[a[i]] = a[i - 1];
    nex[a[i - 1]] = a[i];
    s.insert(a[i]);
    pos[a[i]] = i;
  }
  pre[a[1]] = n + 1;
  nex[a[n]] = n + 2;
  p = 1;
  while (s.size()) {
    int u = *s.rbegin();
    ans[pos[u]] = p;
    s.erase(u);
    int v = u;
    cnt = 1;
    while (cnt <= k) {
      if (nex[u] == n + 2) break;
      u = nex[u];
      ans[pos[u]] = p;
      s.erase(u);
      cnt++;
    }
    cnt = 1;
    while (cnt <= k) {
      if (pre[v] == n + 1) break;
      v = pre[v];
      ans[pos[v]] = p;
      s.erase(v);
      cnt++;
    }
    u = nex[u];
    v = pre[v];
    nex[v] = u;
    pre[u] = v;
    if (p == 1)
      p = 2;
    else
      p = 1;
  }
  for (int i = 1; i <= n; i++) cout << ans[i];
}
