#include <bits/stdc++.h>
using namespace std;
const int maxN = 4e5 + 70;
set<int> num, pos;
set<int>::iterator it;
int a[maxN], b[maxN], N, K, ans[maxN];
int main() {
  scanf("%d%d", &N, &K);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &a[i]);
    b[a[i]] = i;
    num.insert(i);
    pos.insert(i);
  }
  int sum = 0, id, team = 2;
  while (sum < N) {
    team = team == 1 ? 2 : 1;
    it = --num.end();
    id = b[*it];
    ans[id] = team;
    it = pos.find(id);
    for (int i = 1; i <= K; i++) {
      it = --num.end();
      id = b[*it];
      it = pos.find(id);
      if (it == pos.begin()) break;
      if (it == pos.end()) break;
      sum++;
      it--;
      ans[*it] = team;
      num.erase(a[*it]);
      pos.erase(it);
    }
    for (int i = 1; i <= K; i++) {
      it = --num.end();
      id = b[*it];
      it = pos.find(id);
      if (it == pos.end()) break;
      if (it == --pos.end()) break;
      it++;
      if (it == pos.end()) break;
      sum++;
      ans[*it] = team;
      num.erase(a[*it]);
      pos.erase(*it);
    }
    sum++;
    it = --num.end();
    id = b[*it];
    num.erase(*it);
    pos.erase(id);
  }
  for (int i = 1; i <= N; i++) printf("%d", ans[i]);
  printf("\n");
  return 0;
}
