#include <bits/stdc++.h>
using namespace std;
vector<int> a;
map<int, int> m;
set<int> se;
void solve() {
  int n, k;
  cin >> n >> k;
  a = vector<int>(n);
  int x;
  se.insert(-1);
  for (auto i = 0; i < n; ++i) {
    cin >> x;
    a[i] = x;
    m[x] = i;
    se.insert(i);
  }
  int f, s;
  f = 1;
  s = 2;
  int poz;
  int count;
  while (!m.empty()) {
    poz = (*--m.end()).second;
    a[poz] = f;
    count = 0;
    auto p = ++se.find(poz);
    while (p != se.end() && count++ < k) {
      m.erase(a[*p]);
      a[*p] = f;
      se.erase(p++);
    }
    count = 0;
    p = --se.find(poz);
    while (p != se.begin() && count++ < k) {
      m.erase(a[*p]);
      a[*p] = f;
      se.erase(p--);
    }
    p = se.find(poz);
    se.erase(p);
    m.erase(--m.end());
    swap(f, s);
  }
  for (auto i = 0; i < n; ++i) cout << a[i];
}
int main() {
  solve();
  return 0;
}
