#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
using ll = long long;
struct debug {
  template <class c>
  debug operator<<(const c&) {
    return *this;
  }
};
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  set<pair<int, int>> skill;
  set<pair<int, int>> pos;
  for (int i = 0; i < n; ++i) {
    int f;
    scanf("%d", &f);
    skill.insert({f, i});
    pos.insert({i, f});
  }
  vector<int> ans(n);
  int cur = 1;
  while (!skill.empty()) {
    int ind = skill.rbegin()->second;
    int sk = skill.rbegin()->first;
    ans[ind] = cur;
    auto it = pos.find({ind, sk});
    debug() << "{"
            << "*it"
            << ", " << *it << "}\n";
    for (int i = 0; i < k; ++i) {
      auto it2 = prev(it);
      debug() << "{"
              << "*it2"
              << ", " << *it2 << "}\n";
      if (it == pos.begin()) {
        break;
      }
      ans[it2->first] = cur;
      skill.erase({it2->second, it2->first});
      pos.erase(it2);
    }
    it = pos.find({ind, sk});
    for (int i = 0; i < k; ++i) {
      auto it2 = next(it);
      if (it2 == pos.end()) {
        break;
      }
      ans[it2->first] = cur;
      skill.erase({it2->second, it2->first});
      pos.erase(it2);
    }
    pos.erase(it);
    skill.erase({sk, ind});
    cur = 3 - cur;
  }
  for (int x : ans) {
    printf("%d", x);
  }
  return 0;
}
