#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > s;
pair<int, int> arr[200001];
int N, K, cnt;
bool cmp(pair<int, int> a, pair<int, int> b) { return a.second > b.second; }
int ret[200001];
int main() {
  scanf("%d %d", &N, &K);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &arr[i].second);
    arr[i].first = i;
    s.insert(arr[i]);
  }
  sort(arr + 1, arr + N + 1, cmp);
  bool flag = true;
  for (int i = 1; i <= N && cnt < N; i++) {
    auto it = s.find(arr[i]);
    pair<int, int> tt = *it;
    if (it == s.end()) continue;
    int k = 0;
    for (auto iit = it; it != s.begin() && k < K;) {
      iit--;
      pair<int, int> tmp = *iit;
      bool end = iit == s.begin();
      if (flag) {
        ret[tmp.first] = 1;
      } else {
        ret[tmp.first] = 2;
      }
      iit = s.erase(iit);
      cnt++;
      if (end) break;
      k++;
    }
    k = 0;
    for (auto iit = it; k <= K && iit != s.end();) {
      if (iit == s.end()) break;
      pair<int, int> tmp = *iit;
      if (flag) {
        ret[tmp.first] = 1;
      } else {
        ret[tmp.first] = 2;
      }
      iit = s.erase(iit);
      cnt++;
      k++;
    }
    flag = flag ^ 1;
  }
  for (int i = 1; i <= N; i++) printf("%d", ret[i]);
}
