#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
void solve() {
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (long long i = 0; i < n; i += 1) cin >> a[i];
  long long pre[n], suff[n];
  memset(pre, 1, n);
  memset(suff, -1, n);
  for (long long i = 0; i < n; i += 1) {
    pre[i] = i + 1;
  }
  for (long long i = 0; i < n; i += 1) {
    suff[i] = i - 1;
  }
  priority_queue<pair<long long, long long>> pq;
  for (long long i = 0; i < n; i += 1) {
    pq.push({a[i], i});
  }
  string ans;
  for (long long i = 0; i < n; i += 1) ans += '0';
  long long fl = 0;
  while (true) {
    if (pq.empty()) break;
    while ((!pq.empty()) && ans[pq.top().second] != '0') {
      pq.pop();
    }
    if (pq.empty()) break;
    long long x = pq.top().first;
    long long i = pq.top().second;
    vector<long long> v;
    v.push_back(i);
    pq.pop();
    if (fl == 0)
      ans[i] = '1';
    else
      ans[i] = '2';
    long long I = i;
    i = suff[i];
    long long K = k;
    while (K-- && i >= 0) {
      v.push_back(i);
      if (fl == 0)
        ans[i] = '1';
      else
        ans[i] = '2';
      i = suff[i];
    }
    long long l = i;
    i = I;
    i = pre[i];
    K = k;
    while (K-- && i < n) {
      v.push_back(i);
      if (fl == 0)
        ans[i] = '1';
      else
        ans[i] = '2';
      i = pre[i];
    }
    if (i >= 0 && i < n) suff[i] = l;
    if (l >= 0 && l < n) pre[l] = i;
    fl ^= 1;
  }
  cout << ans << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long tin = 1;
  while (tin--) {
    solve();
  }
  return 0;
}
