#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
int nxi() {
  int a;
  cin >> a;
  return a;
}
vector<long long> a;
void inc(int i, long long v) {
  for (; i < a.size(); i |= i + 1) {
    a[i] = max(a[i], v);
  }
}
long long get(int r) {
  long long ans = 0;
  for (; r >= 0; r = (r & (r + 1)) - 1) {
    ans = max(ans, a[r]);
  }
  return ans;
}
long long get(int l, int r) { return get(r) - get(l - 1); }
template <class _T>
_T gcd(_T a, _T b) {
  return a == 0 ? b : gcd(b % a, a);
}
int main() {
  int n = nxi(), k = nxi();
  vector<int> a(n), pos(n), align(n, -1), jumpL(n, -2), jumpR(n, -2);
  int i = 0;
  for (int& v : a) {
    cin >> v;
    v--;
    pos[v] = i++;
  }
  int maxEl = n - 1;
  int team = 0;
  while (true) {
    while (maxEl >= 0) {
      if (align[maxEl] == -1) break;
      maxEl--;
    }
    if (maxEl == -1) break;
    int p = pos[maxEl];
    align[maxEl] = team;
    int lRange = p - 1;
    for (int i = 0; i < k; ++i) {
      while (lRange >= 0 && jumpL[lRange] != -2) {
        lRange = jumpL[lRange];
      }
      if (lRange == -1) break;
      lRange--;
    }
    while (lRange >= 0 && jumpL[lRange] != -2) {
      lRange = jumpL[lRange];
    }
    int rRange = p + 1;
    for (int i = 0; i < k; ++i) {
      while (rRange < n && jumpR[rRange] != -2) {
        rRange = jumpR[rRange];
      }
      if (rRange == n) break;
      rRange++;
    }
    while (rRange < n && jumpR[rRange] != -2) {
      rRange = jumpR[rRange];
    }
    jumpL[p] = lRange, jumpR[p] = rRange;
    int l = p - 1;
    for (int i = 0; i < k; ++i) {
      while (l >= 0 && jumpL[l] != -2) {
        l = jumpL[l];
      }
      if (l == -1) break;
      jumpL[l] = lRange;
      jumpR[l] = rRange;
      align[a[l]] = team;
      l--;
    }
    int r = p + 1;
    for (int i = 0; i < k; ++i) {
      while (r < n && jumpR[r] != -2) {
        r = jumpR[r];
      }
      if (r == n) break;
      jumpL[r] = lRange;
      jumpR[r] = rRange;
      align[a[r]] = team;
      r++;
    }
    team ^= 1;
  }
  for (int _a : a) cout << (align[_a] + 1);
  return 0;
}
