#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  vector<bool> ah(n + 1, true);
  vector<pair<int, int> > ap(n);
  vector<int> atr(n);
  vector<int> res(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    ap[i].first = a[i];
    ap[i].second = i;
  }
  int l = 0;
  sort(ap.begin(), ap.end(), greater<pair<int, int> >());
  for (auto b : ap) {
    if (ah[b.second]) {
      int c = b.second;
      ah[c] = false;
      res[c] = l + 1;
      int e, f;
      for (int j = 0; j < k; ++j) {
        ++c;
        e = c;
        if (c < n && ah[c]) {
          res[c] = l + 1;
          ah[c] = false;
        } else if (c >= n) {
          e = n;
          break;
        } else if (!ah[c]) {
          c = atr[c];
          --j;
        }
      }
      c = b.second;
      for (int j = 0; j < k; ++j) {
        --c;
        f = c;
        if (c > -1 && ah[c]) {
          res[c] = l + 1;
          ah[c] = false;
        } else if (c < 0) {
          f = -1;
          break;
        } else if (!ah[c]) {
          c = atr[c];
          --j;
        }
      }
      if (e < n) atr[e] = f;
      if (f > -1) atr[f] = e;
      l = (l + 1) % 2;
    }
  }
  for (auto g : res) cout << g;
}
