#include <bits/stdc++.h>
using namespace std;
int sc(int &x) { return scanf("%d", &x); }
int sc(unsigned int &x) { return scanf("%u", &x); }
int sc(long long &x) { return scanf("%lld", &x); }
int sc(unsigned long long &x) { return scanf("%llu", &x); }
int sc(double &x) { return scanf("%lf", &x); }
int sc(long double &x) { return scanf("%Lf", &x); }
int sc(char *x) { return scanf("%s", x); }
int sc(char &x) { return scanf("%c", &x); }
template <typename T, typename... Args>
void sc(T &v, Args &...args) {
  sc(v);
  sc(args...);
}
void pr(const int &x) { printf("%d", x); }
void pr(const unsigned int &x) { printf("%u", x); }
void pr(const long long &x) { printf("%lld", x); }
void pr(const unsigned long long &x) { printf("%llu", x); }
void pr(const double &x) { printf("%.10lf", x); }
void pr(const long double &x) { printf("%.10Lf", x); }
void pr(const char *const &x) { printf("%s", x); }
void pr(char *const &x) { printf("%s", x); }
void pr(const char &x) { printf("%c", x); }
template <typename T, typename... Args>
void pr(T const &v, Args const &...args) {
  pr(v);
  pr(' ');
  pr(args...);
}
const long long MOD = 1e9 + 7;
inline void _add(long long &a, long long b) { a = (a + b) % MOD; }
inline void _sub(long long &a, long long b) { a = (a + MOD - b) % MOD; }
inline void _mul(long long &a, long long b) { a = (long long)a * b % MOD; }
inline long long _Add(long long a, long long b) { return (a + b) % MOD; }
inline long long _Sub(long long a, long long b) { return (a + MOD - b) % MOD; }
inline long long _Mul(long long a, long long b) { return a * b % MOD; }
const int MAXN = 200010;
struct node1 {
  int a, id;
  node1(int _a, int _id) {
    a = _a;
    id = _id;
  }
};
bool operator<(const node1 a, const node1 b) { return a.a > b.a; }
struct node2 {
  int a, id;
  node2(int _a, int _id) {
    a = _a;
    id = _id;
  }
};
bool operator<(const node2 a, const node2 b) { return a.id < b.id; }
struct node3 {
  int a, id;
  node3(int _a, int _id) { a = _a, id = _id; }
};
bool operator<(const node3 a, const node3 b) { return a.id > b.id; }
int vis[MAXN];
set<node1> s1;
set<node2> s2;
set<node3> s3;
int main() {
  s1.clear();
  s2.clear();
  int n, k;
  sc(n, k);
  int a;
  for (int i = 1, lim = n; i <= lim; ++i) {
    sc(a);
    s1.insert(node1(a, i));
    s2.insert(node2(a, i));
    s3.insert(node3(a, i));
  }
  int op = 0;
  int num;
  set<node2>::iterator it2;
  set<node3>::iterator it3;
  for (set<node1>::iterator it1 = s1.begin(); it1 != s1.end(); it1++) {
    if (vis[(*it1).id] != 0) continue;
    vis[(*it1).id] = op + 1;
    num = 0;
    while (num < k) {
      it2 = s2.lower_bound(node2((*it1).a, (*it1).id));
      if (it2 == s2.end()) break;
      s2.erase(it2);
      if (vis[(*it2).id] != 0) continue;
      num++;
      vis[(*it2).id] = op + 1;
    }
    num = 0;
    while (num < k) {
      it3 = s3.lower_bound(node3((*it1).a, (*it1).id));
      if (it3 == s3.end()) break;
      s3.erase(it3);
      if (vis[(*it3).id] != 0) continue;
      num++;
      vis[(*it3).id] = op + 1;
    }
    op ^= 1;
  }
  for (int i = 1, lim = n; i <= lim; ++i) pr(vis[i]);
  pr("\n");
  return 0;
}
