#include <bits/stdc++.h>
using namespace std;
void FAST() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
void solve() {}
int main() {
  FAST();
  int n, k;
  cin >> n >> k;
  int arr[n + 7], ans[n + 7];
  set<pair<int, int> > si, sv;
  for (int first = 0; first < n; ++first) {
    cin >> arr[first];
    si.insert({first, arr[first]});
    sv.insert({arr[first], first});
  }
  int p = 0;
  while (si.size() > 0) {
    pair<int, int> t = *sv.rbegin();
    sv.erase(t);
    si.erase({t.second, t.first});
    ans[t.second] = p;
    for (int first = 0; first < k; ++first) {
      auto it1 = si.lower_bound({t.second, 0});
      if (it1 == si.end()) break;
      pair<int, int> it = *it1;
      ans[it.first] = p;
      sv.erase({it.second, it.first});
      si.erase(it);
    }
    for (int first = 0; first < k; ++first) {
      auto it1 = si.upper_bound({t.second, 0});
      if (it1 == si.begin()) break;
      it1--;
      pair<int, int> it = *it1;
      ans[it.first] = p;
      sv.erase({it.second, it.first});
      si.erase(it);
    }
    p = (p + 1) % 2;
  }
  for (int first = 0; first < n; ++first) cout << ans[first] + 1;
  return 0;
}
