#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  pair<long long, long long> a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a, a + n);
  queue<long long> q;
  set<long long> s;
  bool turn = true;
  long long ans[n];
  for (long long i = n - 1; i >= 0; i--) {
    q.push(a[i].second);
    s.insert(i);
  }
  while (!q.empty()) {
    long long top = q.front();
    q.pop();
    if (s.find(top) == s.end()) continue;
    vector<long long> v;
    long long count = 0;
    for (auto itr = prev(s.find(top)); count < k && itr != prev(s.begin());
         itr--) {
      v.push_back(*itr);
      count++;
    }
    count = 0;
    for (auto itr = s.find(top); count <= k && itr != s.end(); itr++) {
      v.push_back(*itr);
      count++;
    }
    for (long long i = 0; i < v.size(); i++) {
      s.erase(v[i]);
      ans[v[i]] = turn;
    }
    turn = !turn;
  }
  for (long long i = 0; i < n; i++) {
    if (ans[i])
      cout << 1;
    else
      cout << 2;
  }
  return 0;
}
