#include <bits/stdc++.h>
using namespace std;
struct compare {
  bool operator()(const pair<long long int, long long int> &l,
                  const pair<long long int, long long int> &r) {
    if (l.first == r.first) return l.second > r.second;
    return l.first > r.first;
  }
};
priority_queue<pair<long long int, long long int>,
               vector<pair<long long int, long long int> >, compare>
    pq;
long long int min(long long int a, long long int b) { return a <= b ? a : b; }
long long int max(long long int a, long long int b) { return a >= b ? a : b; }
long long int abso(long long int n) { return n >= 0 ? n : -n; }
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  set<pair<int, int> > S;
  vector<int> V, O;
  unordered_map<int, int> N, P;
  int n, k;
  cin >> n >> k;
  int num;
  V.resize(n);
  O.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> num;
    V[i] = num;
    S.insert(pair<int, int>(num, i));
    N[i] = i + 1;
    P[i] = i - 1;
  }
  int cnt = 0, turn = 1;
  while (cnt < n) {
    pair<int, int> max_el = *S.rbegin();
    int ind = max_el.second, st, end;
    int c = 0;
    ind = P[max_el.second];
    while (c < k && ind >= 0) {
      pair<int, int> el = pair<int, int>(V[ind], ind);
      S.erase(el);
      O[ind] = turn;
      ind = P[ind];
      c++;
    }
    st = ind;
    cnt += c;
    c = 0;
    ind = N[max_el.second];
    while (c < k && ind < n) {
      pair<int, int> el = pair<int, int>(V[ind], ind);
      S.erase(el);
      O[ind] = turn;
      ind = N[ind];
      c += 1;
    }
    cnt += c;
    end = ind;
    N[st] = end;
    P[end] = st;
    S.erase(max_el);
    O[max_el.second] = turn;
    cnt += 1;
    turn = turn == 1 ? 2 : 1;
  }
  for (int i = 0; i < n; i++) cout << O[i];
  cout << "\n";
  return 0;
}
