#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const long long int MXN = 1e18;
struct node {
  int a, i;
} a[2 * N];
int x[2 * N], ans[2 * N], sp1[2 * N], sp2[2 * N];
bool f[2 * N];
bool cmp(node a, node b) { return a.a > b.a; }
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> x[i];
    a[i].a = x[i];
    a[i].i = i;
    sp1[i] = i - 1;
    sp2[i] = i + 1;
  }
  sort(a + 1, a + 1 + n, cmp);
  int id = 0;
  memset(f, false, sizeof(f));
  for (int i = 1; i <= n; i++) {
    if (f[a[i].i]) {
      continue;
    }
    f[a[i].i] = true;
    ans[a[i].i] = id + 1;
    int l = 1, r = n, xi = a[i].i;
    for (int j = 1; j <= k; j++) {
      xi = sp1[xi];
      if (xi < 1) break;
      l = xi;
      f[xi] = true;
      ans[xi] = id + 1;
    }
    xi = a[i].i;
    for (int j = 1; j <= k; j++) {
      xi = sp2[xi];
      if (xi > n) break;
      r = xi;
      f[xi] = true;
      ans[xi] = id + 1;
    }
    int x = sp1[l], y = sp2[r];
    sp1[r] = sp1[l];
    sp2[l] = sp2[r];
    sp2[x] = y;
    sp1[y] = x;
    id = (id + 1) % 2;
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i];
  }
}
