#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }
struct M {
using T = int;
static T op(const T& a, const T& b) { return a + b; }
static constexpr T e() { return 0; }
};
template<class M> struct ST {
using T = typename M::T;
int n;
V<T> t;
ST(int n) : n(n) {
t.assign(2 * n, M::e());
}
void build() {
for (int i = n - 1; i; i--) t[i] = M::op(t[2 * i], t[2 * i + 1]);
}
T get(int l, int r) {
T resl = M::e(), resr = M::e();
for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
if (l & 1) resl = M::op(resl, t[l++]);
if (r & 1) resr = M::op(t[--r], resr);
}
return M::op(resl, resr);
}
void set(int i, const T& a) {
for (t[i += n] = a; i >>= 1;) t[i] = M::op(t[2 * i], t[2 * i + 1]);
}
};
int main() {
cin.tie(NULL); ios::sync_with_stdio(false);
int n, k; cin >> n >> k;
V<> x(n); for (int i = 0; i < n; i++) cin >> x[i], x[i]--;
V<> ix(n); for (int i = 0; i < n; i++) ix[x[i]] = i;
ST<M> st(n);
for (int i = 0; i < n; i++) {
st.set(x[i], 1);
if (i < k - 1) continue;
int l = 0, r = n;
while (r - l > 1) {
int m = (l + r) / 2;
if (st.get(0, m) < k) l = m;
else r = m;
}
cout << ix[r - 1] + 1 << '\n';
}
}