#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[200001];
set<int> s;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  queue<int> q;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
    s.insert(i);
  }
  sort(a, a + n);
  reverse(a, a + n);
  string ans = string(n, '0');
  for (int i = 0; i < n; i++) q.push(a[i].second);
  char turn = '2';
  while (!s.empty()) {
    if (turn == '2')
      turn = '1';
    else
      turn = '2';
    while (!s.count(q.front())) q.pop();
    int index = q.front();
    q.pop();
    set<int>::iterator it;
    it = s.find(index);
    vector<int> add;
    for (int i = 0; i <= k; i++) {
      if (it == s.end()) break;
      add.push_back(*it);
      it++;
    }
    it = (s.find(index));
    for (int i = 0; i < k; i++) {
      if (i == 0) {
        if (it == s.begin()) {
          break;
        }
        it--;
      }
      add.push_back(*it);
      if (it == s.begin()) break;
      it--;
    }
    for (int i = 0; i < add.size(); i++) {
      ans[add[i]] = turn;
      s.erase(s.find(add[i]));
    }
  }
  cout << ans;
  return 0;
}
