#include <bits/stdc++.h>
using namespace std;
vector<bool> prime(1000000, 1);
long long M = 1e9 + 7;
long long powmodM(long long a, long long b, long long c = M) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % M;
    a = (a * a) % M;
    b /= 2;
  }
  return res;
}
long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a);
    a = (a * a);
    b /= 2;
  }
  return res;
}
long long gcd(long long a, long long b) {
  while (a && b) a > b ? a %= b : b %= a;
  return a + b;
}
long long lcm(long long a, long long b) {
  return (max(a, b) / gcd(a, b)) * min(a, b);
}
vector<long long> sieve(int n) {
  vector<long long> ans;
  prime[0] = false;
  prime[1] = false;
  for (int p = 2; p * p <= n; p++)
    if (prime[p])
      for (int i = p * p; i <= n; i += p) prime[i] = 0;
  for (long long p = (2); p <= (n); ++p)
    if (prime[p]) ans.push_back(p);
  return ans;
}
long long modInverse(long long n, long long p = M) {
  return powmodM(n, p - 2, p);
}
long long nCrModP(long long n, long long r, long long p = M) {
  if (r == 0) return 1;
  long long fac[n + 1];
  fac[0] = 1;
  for (long long i = (1); i <= (n); ++i) fac[i] = fac[i - 1] * i % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
double pie = 3.14159265358979323846264338;
const int INF = 0x3f3f3f3f;
class l {
 public:
  int data;
  l* next = NULL;
  l* prev = NULL;
  l(int d) {
    data = d;
    next = NULL;
    prev = NULL;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  if (n <= 1) {
    cout << 1;
    return 0;
  }
  int a;
  cin >> a;
  map<int, pair<l*, int>> list;
  l* prev = new l(a);
  l* head = prev;
  list[a] = {prev, 0};
  int i = 1;
  while (i < n) {
    cin >> a;
    l* curr = new l(a);
    curr->prev = prev;
    curr->next = NULL;
    prev->next = curr;
    prev = prev->next;
    list[a] = {prev, i};
    i++;
  }
  int maax = 200000;
  bool first = 0;
  vector<long long> res(n);
  while (list.size()) {
    if (list.find(maax) == list.end()) {
      maax--;
      continue;
    }
    first = !first;
    l* temp = list[maax].first;
    l* pre = temp;
    if (first)
      res[list[maax].second] = 1;
    else
      res[list[maax].second] = 2;
    list.erase(maax);
    int f = 0;
    while (f < k && temp->next != NULL) {
      f++;
      temp = temp->next;
      if (first)
        res[list[temp->data].second] = 1;
      else
        res[list[temp->data].second] = 2;
      list.erase(temp->data);
    }
    f = 0;
    while (f < k && pre->prev != NULL) {
      f++;
      pre = pre->prev;
      if (first)
        res[list[pre->data].second] = 1;
      else
        res[list[pre->data].second] = 2;
      list.erase(pre->data);
    }
    if (temp->next != NULL && pre->prev != NULL) {
      pre->prev->next = temp->next;
      temp->next->prev = pre->prev;
    } else if (temp->next == NULL && pre->prev != NULL) {
      pre->prev->next = NULL;
    } else if (temp->next != NULL && pre->prev == NULL) {
      temp->next->prev = NULL;
    }
    maax--;
  }
  for (long long i = (0); i <= (n - 1); ++i) {
    cout << res[i];
  }
}
