#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, k;
  cin >> n >> k;
  long long int a[n + 1], b[n + 1];
  char ans[n + 1];
  set<long long int> st;
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
    b[a[i]] = i;
    st.insert(i);
  }
  char w = '1';
  for (long long int i = n; i > 0; i--) {
    long long int idx = b[i];
    if (st.count(idx)) {
      auto e = st.end();
      e--;
      auto it = st.find(idx);
      auto itf = it, itb = it;
      if (it == st.begin()) {
        itf++;
      } else if (it == e) {
        itb--;
      } else {
        itf++;
        itb--;
      }
      vector<long long int> v;
      v.push_back(*it);
      long long int z = k;
      while (z--) {
        if (itf == st.end()) break;
        v.push_back(*itf);
        itf++;
      }
      z = k;
      while (z--) {
        v.push_back(*itb);
        if (itb == st.begin()) break;
        itb--;
      }
      for (auto g : v) {
        ans[g] = w;
        st.erase(g);
      }
      if (w == '1') {
        w = '2';
      } else {
        w = '1';
      }
    }
  }
  for (long long int i = 1; i <= n; i++) {
    cout << ans[i];
  }
}
