#include <bits/stdc++.h>
using namespace std;
set<int> st;
set<int>::iterator itr;
map<int, int> taken;
;
struct pup {
  int w, idx;
};
bool cmp(pup a, pup b) { return a.w > b.w; }
int main() {
  int n, k;
  cin >> n >> k;
  pup a[n];
  for (int i = 0; i < n; i++) {
    st.insert(i);
    cin >> a[i].w;
    a[i].idx = i;
  }
  sort(a, a + n, cmp);
  int i = 0;
  for (int mov = 1; mov <= n; mov++) {
    for (; i < n; i++) {
      if (taken[a[i].idx] == 0) {
        taken[a[i].idx] = 2 - mov % 2;
        itr = st.find(a[i].idx);
        int first = *itr;
        int last = *itr;
        if (itr != st.begin()) {
          itr--;
          for (int j = 1; j <= k; j++, itr--) {
            int p = *itr;
            first = p;
            taken[p] = 2 - mov % 2;
            if (itr == st.begin()) {
              break;
            }
          }
        }
        itr = st.find(a[i].idx);
        if (itr != st.end()) {
          itr++;
          for (int j = 1; itr != st.end() && j <= k; j++, itr++) {
            int p = *itr;
            last = p;
            taken[p] = 2 - mov % 2;
          }
        }
        set<int>::iterator itr2;
        itr = st.find(first);
        itr2 = st.find(last);
        for (;;) {
          set<int>::iterator itr3 = itr2;
          if (*itr2 == first) {
            itr2--;
            st.erase(itr3);
            break;
          }
          itr2--;
          st.erase(itr3);
        }
        break;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << taken[i];
  }
}
