#include <bits/stdc++.h>
using namespace std;
const int maxn = 201000;
int n, k;
int num[maxn], li[maxn], ri[maxn];
int sum[maxn << 2], ans[maxn];
void build(int l, int r, int rt) {
  if (l == r) {
    sum[rt] = num[l];
    return;
  }
  int mid = (l + r) / 2;
  build(l, mid, rt << 1);
  build(mid + 1, r, rt << 1 | 1);
  sum[rt] = max(sum[rt << 1], sum[rt << 1 | 1]);
}
void change(int L, int R, int l, int r, int rt) {
  if (L <= l && r <= R) {
    sum[rt] = -1;
    return;
  }
  int mid = (l + r) / 2;
  if (L <= mid) change(L, R, l, mid, rt << 1);
  if (R > mid) change(L, R, mid + 1, r, rt << 1 | 1);
  sum[rt] = max(sum[rt << 1], sum[rt << 1 | 1]);
}
int ask(int l, int r, int rt) {
  if (l == r) return l;
  int mid = (l + r) / 2;
  if (sum[rt] == sum[rt << 1])
    return ask(l, mid, rt << 1);
  else
    return ask(mid + 1, r, rt << 1 | 1);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &num[i]);
  for (int i = 1; i <= n; i++) {
    li[i] = (i == 1 ? -1 : i - 1);
    ri[i] = (i == n ? -1 : i + 1);
  }
  build(1, n, 1);
  int flag = 1;
  while (1) {
    int now = sum[1];
    if (now == -1) break;
    now = ask(1, n, 1);
    int st = now, ed = now;
    ans[now] = flag;
    for (int i = 1; i <= k; i++) {
      int ed1 = ri[ed];
      if (ed1 == -1) break;
      ed = ed1;
      ans[ed] = flag;
    }
    for (int i = 1; i <= k; i++) {
      int st1 = li[st];
      if (st1 == -1) break;
      st = st1;
      ans[st] = flag;
    }
    change(st, ed, 1, n, 1);
    st = li[st], ed = ri[ed];
    li[ed] = st;
    ri[st] = ed;
    flag ^= 1;
  }
  for (int i = 1; i <= n; i++) {
    if (ans[i])
      printf("1");
    else
      printf("2");
  }
  return 0;
}
