#include <bits/stdc++.h>
using namespace std;
using INT = long long;
using pii = pair<int, int>;
set<pii> pos, st;
int a[200010];
int ans[200010];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= n; i++) {
    pos.insert({i, a[i]});
    st.insert({a[i], i});
  }
  int op = 1;
  while (!st.empty()) {
    auto p = *--st.end();
    auto it = pos.lower_bound({p.second, a[p.second]});
    int step = k;
    vector<int> res;
    res.push_back((*it).first);
    while (step--) {
      it++;
      if (it == pos.end()) break;
      res.push_back((*it).first);
    }
    step = k;
    it = pos.lower_bound({p.second, a[p.second]});
    while (step--) {
      if (it == pos.begin()) break;
      it--;
      res.push_back((*it).first);
    }
    for (auto first : res) {
      ans[first] = op;
      pos.erase({first, a[first]});
      st.erase({a[first], first});
    }
    if (op == 1)
      op = 2;
    else
      op = 1;
  }
  for (int i = 1; i <= n; i++) printf("%d", ans[i]);
  return 0;
}
