#include <bits/stdc++.h>
using namespace std;
int main() {
  iostream::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  int* a = new int[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) a[i]--;
  set<int> left;
  for (int i = 0; i < n; i++) left.insert(i);
  int* pos = new int[n];
  for (int i = 0; i < n; i++) pos[a[i]] = i;
  int* typ = new int[n];
  int* done = (int*)calloc(n, sizeof(int));
  int type = 1;
  for (int i = n; i--;) {
    if (done[i]) continue;
    int j = pos[i];
    typ[j] = type;
    done[a[j]];
    left.erase(j);
    for (int l = 0; l < k; l++) {
      auto itr = left.lower_bound(j);
      if (itr == left.begin()) break;
      int le = *(--itr);
      done[a[le]] = 1;
      typ[le] = type;
      left.erase(le);
    }
    for (int l = 0; l < k; l++) {
      auto itr = left.lower_bound(j);
      if (itr == left.end()) break;
      int le = *itr;
      done[a[le]] = 1;
      typ[le] = type;
      left.erase(le);
    }
    type = 3 - type;
  }
  for (int i = 0; i < n; i++) cout << typ[i];
  cout << '\n';
}
