#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[200010], p[200010];
int h[4 * 200010];
int u[200010], rs[200010];
int K, idx;
void build(int st, int dr, int nod) {
  if (st == dr) {
    h[nod] = 1;
    return;
  }
  int mid = (st + dr) >> 1;
  build(st, mid, (nod << 1));
  build(mid + 1, dr, ((nod << 1) | 1));
  h[nod] = h[(nod << 1)] + h[((nod << 1) | 1)];
}
int updater(int st, int dr, int nod, int v) {
  if (st > dr || !h[nod] || !v) return 0;
  if (st == dr) {
    h[nod] = 0;
    rs[st] = K;
    u[a[st]] = 1;
    return 1;
  }
  int mid = (st + dr) >> 1;
  int x = 0;
  if (idx <= mid) x = updater(st, mid, (nod << 1), v);
  if (v > x) x += updater(mid + 1, dr, ((nod << 1) | 1), v - x);
  h[nod] = h[(nod << 1)] + h[((nod << 1) | 1)];
  return x;
}
int updatel(int st, int dr, int nod, int v) {
  if (st > dr || !h[nod] || !v) return 0;
  if (st == dr) {
    h[nod] = 0;
    rs[st] = K;
    u[a[st]] = 1;
    return 1;
  }
  int mid = (st + dr) >> 1;
  int x = 0;
  if (idx >= mid + 1) x = updatel(mid + 1, dr, ((nod << 1) | 1), v);
  if (v > x) x += updatel(st, mid, (nod << 1), v - x);
  h[nod] = h[(nod << 1)] + h[((nod << 1) | 1)];
  return x;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i], p[a[i]] = i;
  int f = n;
  K = 1;
  build(1, n, 1);
  while (f >= 1) {
    while (u[f] && f >= 1) --f;
    if (f < 1) break;
    idx = p[f];
    rs[idx] = K;
    updater(1, n, 1, 1);
    idx++;
    updater(1, n, 1, k);
    idx -= 2;
    updatel(1, n, 1, k);
    K = 3 - K;
    --f;
  }
  for (int i = 1; i <= n; ++i) cout << rs[i];
  return 0;
}
