#include <bits/stdc++.h>
using namespace std;
const long long int logx = 30;
const long long int N = 2e5 + 5;
const long long int INF = 1e9 + 5;
const long long int mod = 1e9 + 7;
const double PI = 3.14159265358979323846;
inline long long int mul(long long int a, long long int b) {
  return (a * 1ll * b) % mod;
}
inline long long int sub(long long int a, long long int b) {
  long long int c = a - b;
  if (c < 0) c += mod;
  return c;
}
inline long long int add(long long int a, long long int b) {
  long long int c = a + b;
  if (c > mod) c -= mod;
  return c;
}
template <typename T>
T power(T x, T y, long long int m) {
  T ans = 1;
  while (y > 0) {
    if (y & 1LL) ans = (ans * x) % m;
    y >>= 1ll;
    x = (x * x) % m;
  }
  return ans % m;
}
long long int n, k, a[N], ans[N], pos[N], mark[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int res = 0;
  cin >> n >> k;
  set<long long int> second;
  priority_queue<long long int> pq;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    pos[a[i]] = i;
    pq.push(a[i]);
    second.insert(i);
  }
  while (pq.size()) {
    long long int cur = pq.top();
    pq.pop();
    if (mark[pos[cur]]) {
      continue;
    }
    res++;
    long long int idx = pos[cur], cnt = 0;
    auto ins = second.lower_bound(idx);
    auto inc = ins;
    vector<long long int> temp;
    while (cnt <= k) {
      temp.push_back(*ins);
      if (ins == second.begin()) {
        break;
      }
      cnt++;
      ins--;
    }
    cnt = 0;
    inc++;
    while (inc != second.end() && cnt < k) {
      temp.push_back(*inc);
      cnt++;
      inc++;
    }
    for (auto i : temp) {
      if (res % 2) {
        ans[i] = 1;
      } else {
        ans[i] = 2;
      }
      mark[i] = 1;
      second.erase(i);
    }
  }
  for (long long int i = 0; i < n; i++) {
    cout << ans[i];
  }
}
