#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const double eps = 1e-9;
int check(int a, int b, int c, int d) {
  if (d == 8) d = 1;
  if ((d == 2 || d == 6) && b) return 1 + check(a, b - 1, c, d + 1);
  if ((d == 3 || d == 5) && c) return 1 + check(a, b, c - 1, d + 1);
  if ((d == 1 || d == 4 || d == 7) && a) return 1 + check(a - 1, b, c, d + 1);
  return 0;
}
int main() {
  int n, k, i, a, f = 1;
  cin >> n >> k;
  vector<pair<int, int>> st;
  vector<int> lf(n, 0);
  vector<int> rf(n, 0);
  for (i = 0; i < n; ++i) {
    cin >> a;
    st.push_back({a, i});
    lf[i] = i - 1;
    rf[i] = i + 1;
  }
  sort(st.begin(), st.end());
  vector<int> us(n, 0);
  for (i = n - 1; i >= 0; --i) {
    if (us[st[i].second]) continue;
    us[st[i].second] = f;
    int p = st[i].second;
    int l = lf[p];
    int z = 0;
    while (l >= 0 && z < k && !us[l]) {
      us[l] = f;
      l = lf[l];
      ++z;
    }
    int r = rf[p];
    z = 0;
    while (r < n && z < k && !us[r]) {
      us[r] = f;
      r = rf[r];
      ++z;
    }
    while (l >= 0 && us[l]) l = lf[l];
    while (r < n && us[r]) r = rf[r];
    if (l >= 0) rf[l] = r;
    if (r < n) lf[r] = l;
    f = (f == 1 ? 2 : 1);
  }
  for (i = 0; i < n; ++i) cout << us[i];
  cout << endl;
  return 0;
}
