#include <bits/stdc++.h>
using namespace std;
set<int> bla;
vector<pair<int, int> > a;
vector<int> res;
int n, k;
void showset() {
  for (set<int>::iterator it = bla.begin(); it != bla.end(); it++)
    cout << *it << " ";
  cout << endl;
}
void solve() {
  cin >> n >> k;
  res.resize(n);
  a.resize(n);
  int who = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
    bla.insert(i);
  }
  sort(a.rbegin(), a.rend());
  queue<int> x;
  for (int i = 0; i < n; i++) x.push(a[i].second);
  string res(n, '0');
  while (bla.size()) {
    while (!bla.count(x.front())) {
      x.pop();
    }
    int pos = x.front();
    x.pop();
    vector<int> add;
    auto it = bla.find(pos);
    for (int i = 0; i <= k; i++) {
      add.push_back(*it);
      if (it == bla.begin()) break;
      it--;
    }
    it = next(bla.find(pos));
    for (int i = 0; i < k; i++) {
      if (it == bla.end()) break;
      add.push_back(*it);
      it++;
    }
    for (auto it : add) {
      bla.erase(it);
      res[it] = '1' + who;
    }
    who ^= 1;
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
