#include <bits/stdc++.h>
using namespace std;
int main() {
  set<pair<int, int>> s1, s2;
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    s1.insert(make_pair(a[i], i));
    s2.insert(make_pair(i, a[i]));
  }
  int x = 0;
  while (s1.size()) {
    if (x == 0) {
      auto it = s1.rbegin();
      auto it1 = s2.find(make_pair(it->second, it->first));
      p[it1->first] = 1;
      it1++;
      for (int z = 0; z < k; z++) {
        if (it1 == s2.end()) break;
        p[it1->first] = 1;
        auto it2 = it1;
        it1++;
        s1.erase(make_pair(it2->second, it2->first));
        s2.erase(it2);
      }
      it1 = s2.find(make_pair(it->second, it->first));
      for (int z = 0; z <= k; z++) {
        p[it1->first] = 1;
        auto it2 = it1;
        if (it1 == s2.begin()) {
          s1.erase(make_pair(it1->second, it1->first));
          s2.erase(it1);
          break;
        }
        it1--;
        s1.erase(make_pair(it2->second, it2->first));
        s2.erase(it2);
      }
      x++;
      x %= 2;
    } else if (x == 1) {
      auto it = s1.rbegin();
      auto it1 = s2.find(make_pair(it->second, it->first));
      p[it1->first] = 2;
      it1++;
      for (int z = 0; z < k; z++) {
        if (it1 == s2.end()) break;
        p[it1->first] = 2;
        auto it2 = it1;
        it1++;
        s1.erase(make_pair(it2->second, it2->first));
        s2.erase(it2);
      }
      it1 = s2.find(make_pair(it->second, it->first));
      for (int z = 0; z <= k; z++) {
        p[it1->first] = 2;
        auto it2 = it1;
        if (it1 == s2.begin()) {
          s1.erase(make_pair(it1->second, it1->first));
          s2.erase(it1);
          break;
        }
        it1--;
        s1.erase(make_pair(it2->second, it2->first));
        s2.erase(it2);
      }
      x++;
      x %= 2;
    }
  }
  for (int i = 0; i < n; i++) cout << p[i];
  return 0;
}
