#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFLL = 1e18;
const int MOD = 998244353;
const int MAXN = 2e5 + 5;
int n, k;
int t[MAXN];
int h[MAXN];
set<pair<int, int> > s;
int main() {
  scanf("%d %d", &n, &k);
  int aux;
  for (int i = 0; i < n; i++) {
    scanf("%d", &aux);
    aux--;
    h[aux] = i;
    s.insert({i, aux});
  }
  int e = 0;
  for (int i = n - 1; i > -1; i--) {
    if (t[h[i]]) continue;
    if (!s.size()) break;
    t[h[i]] = e + 1;
    auto it = s.lower_bound({h[i], 0});
    s.erase(it);
    if (!s.size()) break;
    for (int _ = 0; _ < k; _++) {
      auto er = s.lower_bound({h[i], 0});
      if (er == s.end()) break;
      t[er->first] = e + 1;
      s.erase(er);
    }
    for (int _ = 0; _ < k; _++) {
      if (!s.size()) break;
      auto er = s.lower_bound({h[i], 0});
      if (er == s.begin()) break;
      er--;
      t[er->first] = e + 1;
      s.erase(er);
    }
    e ^= 1;
  }
  for (int i = 0; i < n; i++) printf("%d", t[i]);
  printf("\n");
  return 0;
}
