#include <bits/stdc++.h>
using namespace std;
int N, K, a[200000 + 3], pos[200000 + 3], answer[200000 + 3],
    leftOf[200000 + 3], rightOf[200000 + 3];
bool done[200000 + 3];
int main() {
  cin >> N >> K;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
    pos[a[i]] = i;
    leftOf[i] = i - 1;
    rightOf[i] = i + 1;
  }
  memset(done, false, sizeof(done));
  int currentNumber = N;
  int currentPlayer = 1;
  while (true) {
    while (done[currentNumber] == true) currentNumber--;
    if (currentNumber == 0) break;
    int position = pos[currentNumber];
    int currentLeft = leftOf[position];
    int currentRight = rightOf[position];
    int counter;
    answer[position] = currentPlayer;
    done[a[position]] = true;
    counter = K;
    while (currentLeft >= 1 && counter > 0) {
      answer[currentLeft] = currentPlayer;
      done[a[currentLeft]] = true;
      currentLeft = leftOf[currentLeft];
      counter -= 1;
    }
    counter = K;
    while (currentRight <= N && counter > 0) {
      answer[currentRight] = currentPlayer;
      done[a[currentRight]] = true;
      currentRight = rightOf[currentRight];
      counter -= 1;
    }
    rightOf[currentLeft] = currentRight;
    leftOf[currentRight] = currentLeft;
    currentPlayer = (currentPlayer == 1 ? 2 : 1);
  }
  for (int i = 1; i <= N; i++) cout << answer[i];
  cout << endl;
}
