#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
using namespace std;
const long long INF = 2e18;
const long double PI = acos(-1);
const long long MOD = 1e9 + 7;
const long long MAXN = 2e5 + 1;
struct node {
  node *left = nullptr;
  node *right = nullptr;
  long long data, size, y, max;
  node(long long x) {
    data = x;
    max = x;
    size = 1;
    y = rand();
  }
};
long long get_size(node *x) {
  if (x) return x->size;
  return 0;
}
long long get_max(node *x) {
  if (x) return x->max;
  return 0;
}
long long get_y(node *x) {
  if (x) return x->y;
  return 0;
}
long long get_data(node *x) {
  if (x) return x->data;
  return 0;
}
void push(node *x) {
  if (x) {
    x->size = get_size(x->left) + get_size(x->right) + 1;
    x->max = max(max(get_data(x), get_max(x->left)), get_max(x->right));
  }
}
pair<node *, long long> find_max(node *root, long long cnt) {
  if (root) {
    if (get_max(root) == get_data(root))
      return {root, cnt + get_size(root->left)};
    else {
      if (get_max(root->left) > get_max(root->right))
        return find_max(root->left, cnt);
      else
        return find_max(root->right, cnt + get_size(root->left) + 1);
    }
  }
  return {nullptr, 0};
}
pair<node *, node *> split(node *root, long long k) {
  if (root) {
    if (get_size(root->left) >= k) {
      node *ret = new node(get_data(root));
      ret->y = root->y;
      ret->right = root->right;
      pair<node *, node *> temp = split(root->left, k);
      ret->left = temp.second;
      push(ret);
      return {temp.first, ret};
    } else {
      node *ret = new node(get_data(root));
      ret->y = root->y;
      ret->left = root->left;
      pair<node *, node *> temp =
          split(root->right, k - get_size(root->left) - 1);
      ret->right = temp.first;
      push(ret);
      return {ret, temp.second};
    }
  }
  return {nullptr, nullptr};
}
node *merge(node *root1, node *root2) {
  if (!root2) return root1;
  if (!root1) return root2;
  if (get_y(root1) > get_y(root2)) {
    root1->right = merge(root1->right, root2);
    push(root1);
    return root1;
  } else {
    root2->left = merge(root1, root2->left);
    push(root2);
    return root2;
  }
}
void dfs(node *root, vector<long long> &ans,
         map<long long, long long> &positions, bool captain) {
  if (root) {
    ans[positions[root->data]] = 2 - captain;
    dfs(root->left, ans, positions, captain);
    dfs(root->right, ans, positions, captain);
  }
}
void solve() {
  long long n, k, x;
  cin >> n >> k;
  cin >> x;
  vector<long long> ans(n, 0);
  map<long long, long long> positions;
  positions[x] = 0;
  node *root = new node(x);
  for (int i = 1; i < n; ++i) {
    cin >> x;
    node *temp = new node(x);
    root = merge(root, temp);
    positions[x] = i;
  }
  bool captain = true;
  while (root) {
    pair<node *, long long> temp = find_max(root, 1);
    pair<node *, node *> first_half =
        split(root, max(0LL, temp.second - k - 1));
    pair<node *, node *> second_half =
        split(root, min(temp.second + k, get_size(root)));
    node *need_union =
        split(second_half.first, max(0LL, temp.second - k - 1)).second;
    dfs(need_union, ans, positions, captain);
    root = merge(first_half.first, second_half.second);
    captain = !captain;
  }
  for (int i = 0; i < n; ++i) cout << ans[i];
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
