#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int lef[N], righ[N];
int teams[N];
int n, k;
int get_lef(int i) {
  if (i < 0) return -1;
  return i == lef[i] ? i : lef[i] = get_lef(lef[i]);
}
int get_righ(int i) {
  if (i >= n) return n;
  return i == righ[i] ? i : righ[i] = get_righ(righ[i]);
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    lef[i] = i;
    righ[i] = i;
    teams[i] = 0;
  }
  int team = 1;
  int x[n];
  priority_queue<pair<int, int>, vector<pair<int, int> > > heap;
  for (int i = 0; i < n; i++) {
    cin >> x[i];
    heap.push(make_pair(x[i], i));
  }
  while (!heap.empty()) {
    pair<int, int> person = heap.top();
    heap.pop();
    int idx = person.second;
    if (teams[idx] != 0) {
      continue;
    }
    int l = get_lef(idx - 1), r = get_righ(idx + 1), cl = 0, cr = 0;
    vector<int> on_left, on_right;
    on_left.push_back(idx);
    on_right.push_back(idx);
    teams[idx] = team;
    while (cl < k && l != -1) {
      on_left.push_back(l);
      teams[l] = team;
      lef[l] = l - 1;
      l = get_lef(l - 1);
      cl++;
    }
    while (cr < k && r != n) {
      on_right.push_back(r);
      teams[r] = team;
      righ[r] = r + 1;
      r = get_righ(r + 1);
      cr++;
    }
    for (int ll : on_left) {
      righ[ll] = r;
    }
    for (int rr : on_right) {
      lef[rr] = l;
    }
    team = team == 1 ? 2 : 1;
  }
  for (int i = 0; i < n; i++) {
    cout << teams[i];
  }
  cout << endl;
  return 0;
}
