#include <bits/stdc++.h>
using namespace std;
template <typename T>
string to_string(const vector<T>& vc, int w) {
  if (vc.empty()) return "";
  if (w + 1 == vc.size()) return to_string(vc[w]);
  return to_string(vc[w]) + "," + to_string(vc, w + 1);
}
template <typename T>
string to_string(const vector<T>& vc) {
  return "{" + to_string(vc, 0) + "}";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
class DebugStream {
} LOG;
template <typename T>
DebugStream& operator<<(DebugStream& s, const T&) {
  return s;
}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int maxN = 1e6 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20,
          bs = 29;
int T[maxN << 1], d[maxN], n, arr[maxN], ky[maxN], k;
void apply(int w, int x) {
  T[w] += x;
  if (w < n) d[w] += x;
}
void pushDown(int w) {
  for (int u = lg; u > 0; u--) {
    int c = w >> u;
    if (d[c]) {
      apply(c << 1, d[c]);
      apply(c << 1 | 1, d[c]);
      d[c] = 0;
    }
  }
}
void pullUp(int w) {
  while (w > 1) {
    w >>= 1;
    T[w] = max(T[w << 1], T[w << 1 | 1]) + d[w];
  }
}
void upd(int l, int r) {
  l += n, r += n;
  int l0 = l, r0 = r;
  for (; l < r; l >>= 1, r >>= 1) {
    if (l & 1) apply(l++, 1);
    if (r & 1) apply(--r, 1);
  }
  pullUp(l0);
  pullUp(r0 - 1);
}
int qry(int l, int r) {
  l += n, r += n;
  pushDown(l);
  pushDown(r - 1);
  int ret = 0;
  for (; l < r; l >>= 1, r >>= 1) {
    if (l & 1) ret = max(ret, T[l++]);
    if (r & 1) ret = max(ret, T[--r]);
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  stack<int> stc;
  stc.push(-1);
  for (int i = 0; i < n; i++) {
    while (stc.top() >= 0 && arr[stc.top()] < arr[i]) stc.pop();
    ky[i] = stc.top() + 1;
    stc.push(i);
  }
  for (int i = 0; i + 1 < k; i++) upd(ky[i], i + 1);
  for (int i = k - 1; i < n; i++) {
    upd(ky[i], i + 1);
    cout << qry(i - k + 1, i + 1) << ' ';
  }
  cout << '\n';
}
