#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int M = 1e9 + 7;
vector<pair<int, pair<int, int> > > v;
set<pair<int, int> > s;
int ans[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k, x;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> x;
    v.push_back({x, {i - 1, i + 1}});
    s.insert({x, i});
  }
  int t = 1;
  set<pair<int, int> >::iterator it;
  while (!s.empty()) {
    it = s.end();
    it--;
    int g = it->second;
    s.erase(it);
    int l = g;
    int f = g;
    ans[g] = t;
    for (int i = 0; i < k; i++) {
      if (l != n) l = v[l].second.second;
      if (f != -1) f = v[f].second.first;
      if (l != n) {
        ans[l] = t;
        if (s.find({v[l].first, l}) != s.end()) s.erase({v[l].first, l});
      }
      if (f != -1) {
        ans[f] = t;
        if (s.find({v[f].first, f}) != s.end()) s.erase({v[f].first, f});
      }
    }
    if (f != -1 && l != n) {
      v[v[f].second.first].second.second = v[l].second.second;
      v[v[l].second.second].second.first = v[f].second.first;
    } else if (f == -1 && l != n)
      v[v[l].second.second].second.first = -1;
    else if (l == n && f != -1)
      v[v[f].second.first].second.second = n;
    if (t == 1)
      t = 2;
    else
      t = 1;
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i];
  }
}
