#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
void printvector(vector<int> v) {
  for (int i : v) cout << i << " ";
  cout << endl;
}
void printset(set<int> s) {
  for (auto it = s.begin(); it != s.end(); ++it) {
    cout << *it << " ";
  }
  cout << endl;
}
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  priority_queue<pair<int, int>> pq;
  while (!pq.empty()) pq.pop();
  set<int> s;
  s.clear();
  for (int i = 0, val; i < n; ++i) {
    scanf("%d", &val);
    pq.push(pair<int, int>(val, i));
    s.insert(i);
  }
  vector<int> ans(n, 0);
  int turn = 1;
  while (!s.empty()) {
    pair<int, int> best = pq.top();
    pq.pop();
    int pos = best.second;
    auto search = s.find(pos);
    if (search != s.end()) {
      auto l = search;
      auto r = search;
      int cnt = 0;
      while (cnt < k) {
        if (l != s.begin())
          --l;
        else
          break;
        ++cnt;
      }
      cnt = 0;
      while (cnt < k) {
        if (r != s.end())
          ++r;
        else
          break;
        ++cnt;
      }
      for (auto it = l; it != s.end(); ++it) {
        ans[*it] = turn;
        if (it == r) break;
      }
      if (r != s.end()) ++r;
      s.erase(l, r);
      turn = 3 - turn;
    }
  }
  for (int i = 0; i < n; ++i) {
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}
