#include <bits/stdc++.h>
using namespace std;
const int LIM = 2e5 + 10;
int sk[LIM], pos[LIM];
int ant[LIM], prox[LIM];
int tim[LIM] = {};
int findant(int a) {
  if (tim[a] == 0) return a;
  return ant[a] = findant(ant[a]);
}
int findprox(int a) {
  if (tim[a] == 0) return a;
  return prox[a] = findprox(prox[a]);
}
int N, K;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> K;
  for (int i = 1; i <= N; i++) {
    ant[i] = i - 1;
    prox[i] = i + 1;
    cin >> sk[i];
    pos[sk[i]] = i;
  }
  int turno = 1, maj = N;
  while (maj > 0) {
    int p = pos[maj], cant = K + 1, cprox = K + 1;
    while (p > 0 && cant) {
      tim[p] = turno;
      int P = p;
      p = findant(p);
      ant[P] = findant(ant[P]);
      cant--;
    }
    p = pos[maj];
    while (p <= N && cprox) {
      tim[p] = turno;
      int P = p;
      p = findprox(p);
      prox[P] = findprox(prox[P]);
      cprox--;
    }
    turno = 3 - turno;
    while (maj > 0 && tim[pos[maj]]) maj--;
  }
  for (int i = 1; i <= N; i++) cout << tim[i];
  cout << '\n';
  return 0;
}
