#include <bits/stdc++.h>
using namespace std;
int a[200005], poz[200005], freq[200005], ans[200005], nextt[200005],
    prevv[200005];
bool cnt;
int main() {
  int n, k, j, jj;
  scanf("%d%d", &n, &k);
  nextt[0] = 1;
  for (int i = 1; i <= n; ++i)
    scanf("%d", &a[i]), poz[a[i]] = i, freq[a[i]] = 1, nextt[i] = i + 1,
                        prevv[i] = i - 1;
  for (int i = n; i >= 1; --i) {
    if (freq[i]) {
      int cntt = 0;
      for (j = poz[i]; j <= n && cntt <= k; j = nextt[j])
        if (freq[a[j]]) ans[j] = cnt + 1, freq[a[j]] = 0, ++cntt;
      cntt = 0;
      for (jj = poz[i] - 1; jj >= 1 && cntt < k && jj - 1 >= 0;
           jj = prevv[jj]) {
        if (freq[a[jj]]) ans[jj] = cnt + 1, freq[a[jj]] = 0, ++cntt;
      }
      nextt[jj] = j;
      prevv[j] = jj;
      if (cnt == 1)
        cnt = 0;
      else
        cnt = 1;
    }
  }
  for (int i = 1; i <= n; ++i) printf("%d", ans[i]);
  return 0;
}
