#include <bits/stdc++.h>
using namespace std;
set<int> positions;
set<int> skills;
map<int, int> SkillToPos;
map<int, int> PosToSkill;
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i <= n; ++i) {
    skills.insert(skills.end(), i);
    positions.insert(positions.end(), i);
  }
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    PosToSkill[i] = x;
    SkillToPos[x] = i;
  }
  bool turn = 0;
  vector<int> ans(n + 2);
  while (skills.size() > 1) {
    int mxSkill = *(--skills.end());
    int posMxSkill = SkillToPos[mxSkill];
    ans[posMxSkill] = turn + 1;
    int lp = 0;
    vector<int> PositionsToDelete;
    vector<int> SkillsToDelete;
    PositionsToDelete.push_back(posMxSkill);
    SkillsToDelete.push_back(mxSkill);
    auto it = positions.find(posMxSkill);
    auto it2 = it;
    ++it;
    --it2;
    for (; it != positions.end(); ++it) {
      if (lp == k) break;
      int curPos = *it;
      PositionsToDelete.push_back(curPos);
      SkillsToDelete.push_back(PosToSkill[curPos]);
      ans[curPos] = turn + 1;
      ++lp;
    }
    lp = 0;
    for (; it2 != positions.begin(); --it2) {
      if (lp == k) break;
      int curPos = *it2;
      ans[curPos] = turn + 1;
      PositionsToDelete.push_back(curPos);
      SkillsToDelete.push_back(PosToSkill[curPos]);
      ++lp;
    }
    for (auto it : PositionsToDelete) {
      positions.erase(it);
    }
    for (auto it : SkillsToDelete) {
      skills.erase(it);
    }
    turn = !turn;
  }
  for (int i = 1; i <= n; ++i) {
    cout << ans[i];
  }
  return 0;
}
