#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int &i : a) cin >> i;
  vector<int> team(n, 0);
  vector<pair<int, int>> players;
  set<int> s;
  for (int i = 0; i < n; ++i) {
    s.insert(i);
    players.emplace_back(1 - a[i], i);
  }
  sort(players.begin(), players.end());
  int move = 1;
  for (auto p : players) {
    if (team[p.second]) continue;
    vector<int> tmp;
    auto r = s.find(p.second);
    auto l = r;
    tmp.push_back(*l);
    for (int i = 0; i < k; ++i) {
      if (l != s.begin()) {
        l--;
        tmp.push_back(*l);
      }
      if (r != prev(s.end())) {
        r++;
        tmp.push_back(*r);
      }
    }
    for (int i : tmp) {
      team[i] = move;
      s.erase(i);
    }
    move = (move == 1 ? 2 : 1);
  }
  for (int i : team) cout << i;
}
