#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  set<int> pos;
  map<int, int> rel;
  vector<int> arr(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    rel[arr[i]] = i;
    pos.insert(i);
  }
  vector<int> visited(n + 1);
  int turn = 0;
  for (int i = n; i >= 1; i--) {
    if (visited[i]) continue;
    auto it = pos.find(rel[i]);
    set<int> to_delete;
    auto it1 = it;
    int cnt1 = 0, cnt2 = 0;
    while (cnt1 <= k) {
      if (it1 == pos.begin()) {
        to_delete.insert(*it1);
        break;
      } else {
        to_delete.insert(*it1);
        cnt1++;
        it1--;
      }
    }
    it1 = it;
    while (cnt2 <= k) {
      if (it1 == pos.end()) {
        break;
      } else {
        to_delete.insert(*it1);
        cnt2++;
        it1++;
      }
    }
    for (auto var : to_delete) {
      visited[arr[var]] = turn + 1;
      pos.erase(var);
    }
    turn = (turn + 1) % 2;
  }
  for (int i = 1; i <= n; i++) {
    cout << visited[arr[i]];
  }
  return 0;
}
