#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int pos[n + 1], a[n][3];
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[i][0] = x, a[i][1] = i - 1, a[i][2] = i + 1;
    pos[x] = i;
  }
  int ans[n];
  memset(ans, 0, sizeof ans);
  for (int i = n, t = 1; i >= 1; i--) {
    if (ans[pos[i]]) continue;
    int en = pos[i] + 1;
    for (int j = pos[i], cnt = 0; j < n and cnt < k + 1;) {
      ans[j] = t;
      en = a[j][2];
      j = a[j][2];
      cnt++;
    }
    int st = pos[i] - 1;
    for (int j = pos[i], cnt = 0; j >= 0 and cnt < k + 1;) {
      ans[j] = t;
      st = a[j][1];
      j = a[j][1];
      cnt++;
    }
    ans[pos[i]] = t;
    if (st >= 0) a[st][2] = en;
    if (en < n) a[en][1] = st;
    t = 3 - t;
  }
  for (int j = 0; j < n; j++) cout << ans[j];
  cout << '\n';
  return 0;
}
