#include <bits/stdc++.h>
using namespace std;
bool endline = false;
bool endline2 = false;
bool space = true;
template <class T>
istream &operator>>(istream &in, vector<T> &v) {
  for (auto &i : v) {
    in >> i;
  }
  return in;
}
template <class T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  for (auto i : v) {
    out << i;
    if (!endline2) {
      if (space) {
        cout << ' ';
      }
    } else {
      cout << '\n';
    }
  }
  if (endline && !endline2) cout << '\n';
  return out;
}
template <class T, class U>
istream &operator>>(istream &in, pair<T, U> &a) {
  in >> a.first >> a.second;
  return in;
}
template <class T, class U>
ostream &operator<<(ostream &out, const pair<T, U> &a) {
  out << a.first << ' ' << a.second;
  return out;
}
struct comp {
  bool operator()(pair<int, int> a, pair<int, int> b) const {
    return (a.first > b.first);
  }
};
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  cin >> a;
  vector<pair<int, int>> v(n);
  v[0] = {-1, 1};
  v.back() = {(int)a.size() - 2, -1};
  set<pair<int, int>, comp> mx;
  for (int i = 0; i < n; i++) {
    mx.insert({a[i], i});
    if (i > 0 && i < (int)a.size() - 1) {
      v[i] = {i - 1, i + 1};
    }
  }
  vector<int> ans(n);
  bool turn = false;
  while (!mx.empty()) {
    int cur = (*mx.begin()).second;
    mx.erase(mx.begin());
    int temp;
    temp = cur;
    for (int i = 0; i <= k; i++) {
      mx.erase({a[temp], temp});
      ans[temp] = turn + 1;
      if (v[temp].first != -1) {
        if (v[temp].second != -1) {
          v[v[temp].second].first = v[temp].first;
        }
        v[v[temp].first].second = v[temp].second;
      } else {
        if (v[temp].second != -1) {
          v[v[temp].second].first = -1;
        }
        break;
      }
      temp = v[temp].first;
    }
    if (v[cur].second != -1) {
      temp = v[cur].second;
      for (int i = 0; i < k; i++) {
        mx.erase({a[temp], temp});
        ans[temp] = turn + 1;
        if (v[temp].second != -1) {
          if (v[temp].first != -1) {
            v[v[temp].first].second = v[temp].second;
          }
          v[v[temp].second].first = v[temp].first;
        } else {
          if (v[temp].first != -1) {
            v[v[temp].first].second = -1;
          }
          break;
        }
        temp = v[temp].second;
      }
    }
    turn = !turn;
  }
  space = false;
  cout << ans;
  return 0;
}
