#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<pair<int, int>> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.rbegin(), a.rend());
  queue<int> x;
  for (int i = 0; i < n; ++i) {
    x.push(a[i].second);
  }
  set<int> s;
  for (int i = 0; i < n; ++i) s.insert(i);
  int r = 0;
  vector<int> ans(n, -1);
  while (!s.empty()) {
    while (s.count(x.front()) == 0) x.pop();
    vector<int> t;
    t.reserve(2 * k + 1);
    t.push_back(x.front());
    auto it = s.find(x.front());
    if (it != s.begin()) {
      it--;
      for (int i = 0; i < k; ++i) {
        t.push_back(*it);
        if (it == s.begin()) break;
        it--;
      }
    }
    it = s.find(x.front());
    if (it != s.end()) {
      it++;
      for (int i = 0; i < k; ++i) {
        if (it == s.end()) break;
        t.push_back(*it);
        it++;
      }
    }
    for (int i : t) {
      s.erase(i);
      ans[i] = r;
    }
    r ^= 1;
  }
  for (int i : ans) cout << i + 1;
  cout << endl;
  return 0;
}
