#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 10;
typedef struct {
  int v;
  int next, pre;
} pe;
pair<int, int> pa[MAX];
pe ab[MAX];
int visit[MAX];
int teamm[MAX];
int main() {
  int n, k, maxx = 0;
  int maxab;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> ab[i].v;
    pa[i].first = ab[i].v;
    pa[i].second = i;
    ab[i].next = i + 1;
    ab[i].pre = i - 1;
  }
  int sump = 0;
  int n1 = n;
  sort(pa + 1, pa + n + 1);
  int team = 0, p1, p2;
  for (maxab = pa[n1].second; n1 > 0; n1--, maxab = pa[n1].second) {
    sump = 0;
    if (visit[maxab] == 1) continue;
    p1 = ab[maxab].pre;
    p2 = ab[maxab].next;
    for (int j = ab[maxab].next; sump != k; sump++) {
      if (j == n + 1) break;
      teamm[j] = team;
      visit[j] = 1;
      j = ab[j].next;
      p2 = j;
    }
    sump = 0;
    for (int j = ab[maxab].pre; sump != k; sump++) {
      if (j == 0) break;
      teamm[j] = team;
      visit[j] = 1;
      j = ab[j].pre;
      p1 = j;
    }
    teamm[maxab] = team;
    ab[p1].next = p2;
    ab[p2].pre = p1;
    team = (team + 1) % 2;
  }
  for (int i = 1; i <= n; i++) {
    cout << teamm[i] + 1;
  }
}
