#include <bits/stdc++.h>
using namespace std;
int main(void) {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  set<int, greater<int> > se;
  std::vector<int> a(n + 1);
  std::vector<int> L(n + 1);
  std::vector<int> R(n + 1);
  std::vector<int> pos(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pos[a[i]] = i;
    L[i] = i - 1;
    R[i] = i + 1;
    se.insert(i);
  }
  int turn = 1;
  std::vector<int> ans(n + 1);
  while (!se.empty()) {
    int t = *se.begin();
    se.erase(t);
    ans[pos[t]] = turn;
    int r = R[pos[t]];
    int l = L[pos[t]];
    int kt = k;
    while (r <= n && kt) {
      se.erase(a[r]);
      ans[r] = turn;
      r = R[r];
      kt--;
    }
    kt = k;
    while (l && kt) {
      se.erase(a[l]);
      ans[l] = turn;
      l = L[l];
      kt--;
    }
    L[r] = l;
    R[l] = r;
    turn ^= 3;
  }
  for (int i = 1; i <= n; i++) cout << ans[i];
  cout << endl;
  return 0;
}
