#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long linf = 0x3f3f3f3f3f3f3f;
const double eps = 1e-6;
const double pi = 3.14159265358979;
const int maxn = 2e5 + 5;
const int maxm = 1e3 + 5;
const int mod = 1e9 + 7;
int n, k;
set<int> s;
queue<int> q;
bool ans[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  vector<pair<int, int> > a(n);
  for (int i = 0; i < n; ++i) cin >> a[i].first;
  for (int i = 0; i < n; ++i) a[i].second = i;
  sort(a.rbegin(), a.rend());
  for (int i = 0; i < n; ++i) q.push(a[i].second);
  for (int i = 0; i < n; ++i) s.insert(i);
  int flag = 0;
  while (!s.empty()) {
    while (!s.count(q.front())) q.pop();
    auto it = s.find(q.front());
    vector<int> tmp;
    for (int i = 1; i <= k + 1; ++i) {
      if (it == s.end()) break;
      tmp.push_back((*it));
      ++it;
    }
    it = (s.find(q.front()));
    for (int i = 1; i <= k; ++i) {
      if (it == s.begin()) break;
      --it;
      tmp.push_back((*it));
    }
    for (auto it : tmp) {
      ans[it] = flag;
      s.erase(it);
    }
    q.pop();
    flag ^= 1;
  }
  for (int i = 0; i < n; ++i)
    if (ans[i])
      cout << 2;
    else
      cout << 1;
  return 0;
}
