#include <bits/stdc++.h>
using namespace std;
int ans[200000] = {0};
void solve() {
  int n, k;
  cin >> n >> k;
  vector<pair<int, int> > a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  set<int> idx;
  queue<int> q;
  for (int i = n - 1; i >= 0; --i) q.push(a[i].second);
  for (int i = 0; i < n; ++i) idx.insert(i);
  int tren = 1;
  while (!idx.empty()) {
    while (!idx.count(q.front())) q.pop();
    int pos = q.front();
    q.pop();
    vector<int> add;
    auto it = idx.find(pos);
    for (int i = 0; i <= k; ++i) {
      add.push_back(*it);
      if (it == idx.begin()) break;
      --it;
    }
    it = next(idx.find(pos));
    for (int i = 0; i < k; ++i) {
      if (it == idx.end()) break;
      add.push_back(*it);
      ++it;
    }
    for (int i = 0; i < add.size(); ++i) {
      ans[add[i]] = tren;
      idx.erase(add[i]);
    }
    if (tren == 2)
      tren = 1;
    else
      tren = 2;
  }
  for (int i = 0; i < n; ++i) cout << ans[i];
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
