#include <bits/stdc++.h>
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
using namespace std;
vector<long long> ft(1, 1LL);
long long n, a, k;
vector<long long> ans;
vector<pair<long long, long long> > qq;
set<long long> s;
void solve() {
  cin >> n >> k;
  ans.resize(n, 0);
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    qq.push_back({a, i});
    s.insert(i);
  }
  long long a = 1;
  sort(qq.rbegin(), qq.rend());
  for (auto z : qq) {
    long long x = z.second;
    if (ans[x]) continue;
    auto j = s.find(x);
    long long c = k + 1;
    while (c-- and j != s.begin()) ans[*j] = a, s.erase(j--);
    if (c != -1 and j == s.begin()) ans[*j] = a, s.erase(j);
    c = k, j = s.lower_bound(x);
    while (c-- and j != s.end()) ans[*j] = a, s.erase(j++);
    a = a == 1 ? 2 : 1;
  }
  for (auto i : ans) cout << i;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
}
