#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const long long mod = 1e9 + 7;
int num[200010], ans[200010];
int pos[200010];
int L[200010], R[200010];
int vis[200010];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &num[i]);
    vis[i] = 0;
    ans[i] = num[i];
    pos[num[i]] = i;
    L[i] = i - 1;
    R[i] = i + 1;
  }
  sort(ans + 1, ans + 1 + n);
  int in = 1;
  for (int i = n; i >= 1; i--) {
    int item = pos[ans[i]];
    if (vis[item]) continue;
    vis[item] = in;
    int t = k;
    int l = L[item];
    while (t-- && l >= 1) {
      vis[l] = in;
      l = L[l];
    }
    int r = R[item];
    t = k;
    while (t-- && r <= n) {
      vis[r] = in;
      r = R[r];
    }
    L[r] = l;
    R[l] = r;
    if (in == 1)
      in = 2;
    else
      in = 1;
  }
  for (int i = 1; i <= n; i++) printf("%d", vis[i]);
  return 0;
}
