#include <bits/stdc++.h>
using namespace std;
set<int> ss;
map<int, int> mm;
int arr[2 * 100003], pr[2 * 100003], nxt[2 * 100003];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < int(n); i++) {
    cin >> arr[i + 1];
    ss.insert(arr[i + 1]);
    mm[arr[i + 1]] = i + 1;
    pr[i + 1] = i;
    nxt[i + 1] = i + 2;
  }
  int ans[n + 1];
  for (int i = 0; i < int(n); i++) {
    if (ss.empty()) break;
    int pos = mm[(*ss.rbegin())];
    int tch = 1 + (i % 2);
    ans[pos] = tch;
    ss.erase(arr[pos]);
    int p_f = pos, p_b = pos;
    int j = k;
    while (nxt[p_f] != n + 1 and j--) {
      p_f = nxt[p_f];
      ss.erase(arr[p_f]);
      ans[p_f] = tch;
    }
    j = k;
    while (pr[p_b] != 0 and j--) {
      p_b = pr[p_b];
      ans[p_b] = tch;
      ss.erase(arr[p_b]);
    }
    pr[nxt[p_f]] = pr[p_b];
    nxt[pr[p_b]] = nxt[p_f];
  }
  for (int i = 0; i < int(n); i++) cout << ans[i + 1];
  cout << "\n";
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  ;
  return 0;
}
