#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> stu;
int p[1000007], nex[1000007], ans[1000007];
bool dec(pair<int, int> p) { return (p.first < p.second); }
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    stu.push_back(make_pair(a, i + 1));
  }
  for (int i = 1; i <= n; i++) {
    nex[i] = i + 1;
  }
  for (int i = 2; i <= n; i++) {
    p[i] = i - 1;
  }
  sort(stu.begin(), stu.end());
  reverse(stu.begin(), stu.end());
  int cnt = 0;
  for (auto v : stu) {
    if (ans[v.second]) continue;
    ans[v.second] = cnt % 2 + 1;
    int ps = v.second, ns = v.second;
    for (int i = 0; i < k; i++) {
      ns = nex[ns];
      if (!ns) break;
      ans[ns] = cnt % 2 + 1;
    }
    for (int i = 0; i < k; i++) {
      ps = p[ps];
      if (!ps) break;
      ans[ps] = cnt % 2 + 1;
    }
    ps = p[ps];
    ns = nex[ns];
    if (ps) nex[ps] = ns;
    if (ns) p[ns] = ps;
    cnt++;
  }
  for (int i = 1; i <= n; i++) cout << ans[i];
  cout << endl;
  return 0;
}
