#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 50;
int n, K, opt, a[N], vis[N], pre[N], net[N];
priority_queue<pair<int, int> > q, p;
int main() {
  scanf("%d%d", &n, &K);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    pre[i] = i - 1;
    net[i] = i + 1;
    q.push(pair<int, int>(a[i], i));
  }
  net[n] = 0;
  while (!q.empty()) {
    while (p.size() && q.top() == p.top()) q.pop(), p.pop();
    int i = 0, j = 0, k = 0;
    if (q.empty()) break;
    for (i = 1, j = net[q.top().second]; i <= K && j; i++, j = net[j])
      vis[j] = opt + 1, p.push(pair<int, int>(a[j], j));
    for (i = 1, k = pre[q.top().second]; i <= K && k; i++, k = pre[k])
      vis[k] = opt + 1, p.push(pair<int, int>(a[k], k));
    vis[q.top().second] = opt + 1;
    q.pop();
    pre[j] = k;
    net[k] = j;
    opt ^= 1;
  }
  for (int i = 1; i <= n; i++) printf("%d", vis[i]);
}
