#include <bits/stdc++.h>
using namespace std;
int n, k;
const int nmax = 1e6 + 10;
int a[nmax];
int res[nmax], id[nmax], L[nmax], R[nmax];
int group = 1;
set<int> s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s.insert(a[i]);
    id[a[i]] = i;
    L[i] = i - 1;
    R[i] = i + 1;
  }
  while (!s.empty()) {
    int x = *(--s.end());
    int l = id[x], r = id[x], d = 0;
    while (d <= k && l >= 1) {
      s.erase(a[l]);
      res[l] = group;
      l = L[l];
      d++;
    }
    d = 0;
    while (d <= k && r <= n) {
      s.erase(a[r]);
      res[r] = group;
      r = R[r];
      d++;
    }
    group = 3 - group;
    L[r] = l;
    R[l] = r;
  }
  for (int i = 1; i <= n; i++) cout << res[i];
  return 0;
}
