#include <bits/stdc++.h>
using namespace std;
int n, k, maxi, mp[200005], ind, v[200005], l, r, c = 1;
bool vis[200005];
pair<int, pair<int, int>> a[200005];
int main() {
  cin >> n >> k;
  maxi = n;
  for (int i = 0; i < n; i++)
    cin >> a[i].first, a[i].second.first = i - 1, a[i].second.second = i + 1,
                       mp[a[i].first] = i;
  while (maxi > 0) {
    l = r = ind = mp[maxi];
    v[ind] = c;
    vis[ind] = true;
    r = ind = a[r].second.second;
    for (int i = 0; i < k && ind < n; i++) {
      v[ind] = c;
      vis[ind] = true;
      r = ind = a[ind].second.second;
    }
    l = ind = a[l].second.first;
    for (int i = 0; i < k && ind > -1; i++) {
      v[ind] = c;
      vis[ind] = true;
      l = ind = a[ind].second.first;
    }
    if (l != -1) a[l].second.second = r;
    a[r].second.first = l;
    while (vis[mp[maxi]] && maxi > 0) maxi--;
    if (c == 1)
      c = 2;
    else
      c = 1;
  }
  for (int i = 0; i < n; i++) cout << v[i];
  return 0;
}
