#include <bits/stdc++.h>
using namespace std;
int mod = 998244353;
long long n, k;
void solve() {
  cin >> n >> k;
  priority_queue<pair<int, int>> q;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    q.push(make_pair(x, i));
  }
  set<int> s;
  string ans(n, '0');
  for (int i = 0; i < n; ++i) s.insert(i);
  int r = 0;
  while (s.size()) {
    while (s.count(q.top().second) == 0) {
      q.pop();
    }
    int pos = q.top().second;
    q.pop();
    vector<int> add;
    auto it = s.find(pos);
    for (int i = 0; i <= k; ++i) {
      add.push_back(*it);
      if (it == s.begin()) break;
      --it;
    }
    it = next(s.find(pos));
    for (int i = 0; i < k; ++i) {
      if (it == s.end()) break;
      add.push_back(*it);
      ++it;
    }
    for (auto it : add) {
      s.erase(it);
      ans[it] = r + '1';
    }
    r ^= 1;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
