#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
int main() {
  int n, k, b;
  cin >> n >> k;
  vector<pair<int, int> > a(n);
  for (int i = 0; i < n; ++i) {
    cin >> b;
    a[i] = {b, i};
  }
  sort(a.rbegin(), a.rend());
  queue<int> q;
  set<int> id;
  for (int i = 0; i < n; ++i) {
    q.push(a[i].second);
    id.insert(i);
  }
  string ans(n, '0');
  bool team = 0;
  while (!id.empty()) {
    while (!id.count(q.front())) q.pop();
    int pos = q.front();
    q.pop();
    auto it = id.find(pos);
    vector<int> add;
    for (int i = 0; i <= k; ++i) {
      add.push_back(*it);
      if (it == id.begin()) break;
      it--;
    }
    it = next(id.find(pos));
    for (int i = 0; i < k; ++i) {
      if (it == id.end()) break;
      add.push_back(*it);
      it++;
    }
    for (auto it : add) {
      id.erase(it);
      ans[it] = team + '1';
    }
    team = !team;
  }
  cout << ans << endl;
  return 0;
}
