#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
int n, k;
int a[MAXN];
void read_input() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
}
int mi[MAXN];
vector<int> graph[MAXN];
int in[MAXN], out[MAXN];
int timer;
void dfs(int v) {
  in[v] = timer++;
  for (auto x : graph[v]) {
    dfs(x);
  }
  out[v] = timer++;
}
const int TSIZE = (1 << 23);
int tree[TSIZE], lazy[TSIZE];
void push(int k, int l, int r) {
  if (lazy[k]) {
    tree[k] += lazy[k];
    if (l != r) {
      lazy[k * 2] += lazy[k];
      lazy[k * 2 + 1] += lazy[k];
    }
    lazy[k] = 0;
  }
}
void update(int k, int l, int r, int i, int j, int val) {
  push(k, l, r);
  if (r < i || l > j || l > r) return;
  if (r <= j && l >= i) {
    tree[k] += val;
    if (l != r) {
      lazy[k * 2] += val;
      lazy[k * 2 + 1] += val;
    }
    return;
  }
  int middle = (l + r) >> 1;
  update(k * 2, l, middle, i, j, val);
  update(k * 2 + 1, middle + 1, r, i, j, val);
  tree[k] = max(tree[k * 2], tree[k * 2 + 1]);
}
void solve() {
  stack<pair<int, int>> st;
  for (int i = n; i >= 1; i--) {
    pair<int, int> temp = {i, a[i]};
    while (!st.empty() && st.top().second <= a[i]) {
      st.pop();
    }
    int ans = n + 1;
    if (!st.empty()) ans = st.top().first;
    st.push(temp);
    graph[ans].push_back(i);
  }
  dfs(n + 1);
  for (int i = 1; i <= k - 1; i++) {
    update(1, 0, timer - 1, in[i], out[i], 1);
  }
  for (int i = k; i <= n; i++) {
    update(1, 0, timer - 1, in[i], out[i], 1);
    push(1, 0, timer - 1);
    cout << tree[1] << " ";
    update(1, 0, timer - 1, in[i - k + 1], out[i - k + 1], -1);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  read_input();
  solve();
  return 0;
}
