#include <bits/stdc++.h>
const int maxn = 2e5 + 10;
const int mod = 20190414;
const int inf = 1e9;
const long long onf = 1e18;
int dir[4][2] = {0, -1, -1, 0, 0, 1, 1, 0};
int dx[] = {-2, -2, -1, -1, 1, 1, 2, 2};
int dy[] = {-1, 1, -2, 2, -2, 2, -1, 1};
using namespace std;
int a[maxn];
int cnt[maxn];
int ans[maxn];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  vector<int> s;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    s.push_back(i);
    cnt[a[i]] = i;
  }
  int flag = 1;
  for (int i = n; i >= 1; i--) {
    int pos = cnt[i];
    if (ans[pos]) continue;
    int now_pos = lower_bound(s.begin(), s.end(), pos) - s.begin();
    int st = max(0, now_pos - k), ed = min((int)s.size() - 1, now_pos + k);
    for (int i = st; i <= ed; i++) ans[s[i]] = flag;
    auto first_pos = lower_bound(s.begin(), s.end(), s[st]);
    auto end_pos = upper_bound(s.begin(), s.end(), s[ed]);
    s.erase(first_pos, end_pos);
    flag = flag == 1 ? 2 : 1;
  }
  for (int i = 1; i <= n; i++) printf("%d", ans[i]);
  return 0;
}
