#include <bits/stdc++.h>
using namespace std;
struct node {
  node* prev;
  node* next;
  int ind, v;
  bool operator()(const node* a, const node* b) { return a->v > b->v; }
};
void remove(node** head, node* del) {
  if (*head == NULL || del == NULL) return;
  if (*head == del) *head = del->next;
  if (del->next != NULL) del->next->prev = del->prev;
  if (del->prev != NULL) del->prev->next = del->next;
  free(del);
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  node* curr = NULL;
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < (int)n; i++) {
    int v;
    cin >> v;
    node* nd = new node();
    nd->ind = i;
    nd->v = v;
    if (curr != NULL) {
      nd->prev = curr;
      curr->next = nd;
      curr = curr->next;
    } else {
      curr = nd;
    }
  }
  while (curr->prev != NULL) curr = curr->prev;
  int m = n;
  node* head = curr;
  vector<int> one(n, 0);
  int p = 0;
  set<node*, node> q;
  curr = head;
  while (curr != NULL) {
    q.insert(curr);
    curr = curr->next;
  }
  while (n > 0) {
    node* best = *q.begin();
    q.erase(best);
    node* left = best->prev;
    node* right = best->next;
    if (!p) one[best->ind] = 1;
    remove(&head, best);
    n--;
    for (int i = 0; i < (int)k; i++) {
      if (left != NULL) {
        curr = left;
        if (!p) one[left->ind] = 1;
        left = left->prev;
        q.erase(curr);
        remove(&head, curr);
        n--;
      }
      if (right != NULL) {
        curr = right;
        if (!p) one[right->ind] = 1;
        right = right->next;
        q.erase(curr);
        remove(&head, curr);
        n--;
      }
    }
    p = (p + 1) % 2;
  }
  for (int i = 0; i < (int)m; i++) cout << (one[i] ? "1" : "2");
  cout << "\n";
  return 0;
}
