#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
const int inf = 0x3f3f3f3f;
int a[maxn], b[maxn];
int flag[maxn];
int f1[maxn], f2[maxn];
int n, k;
int findf1(int x) {
  if (x <= 0) return 0;
  if (flag[x]) return f1[x] = findf1(f1[x]);
  return x;
}
int findf2(int x) {
  if (x > n) return n + 1;
  if (flag[x]) return f2[x] = findf2(f2[x]);
  return x;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> n >> k;
  for (int i = (1); i < (n + 1); i++) {
    cin >> a[i];
    b[a[i]] = i;
    f1[i] = f2[i] = i;
  }
  int m = n;
  int p = 1;
  for (int i = n; i > 0; i--) {
    if (flag[b[i]]) continue;
    int d = b[i];
    flag[d] = p;
    f1[d] = d - 1;
    f2[d] = d + 1;
    int j1 = d - 1, j2 = d + 1;
    for (int j = (0); j < (k); j++) {
      j1 = findf1(j1);
      if (j1 > 0) {
        flag[j1] = p;
        f2[j1] = d;
        f1[j1] = j1 - 1;
        j1--;
      }
      j2 = findf2(j2);
      if (j2 <= n) {
        flag[j2] = p;
        f1[j2] = d;
        f2[j2] = j2 + 1;
        j2++;
      }
      if (j1 <= 0 && j2 > n) break;
    }
    p--;
    if (!p) p = 2;
  }
  for (int i = (1); i < (n + 1); i++) cout << flag[i];
  return 0;
}
