#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000025;
int in[MAX_N], out[MAX_N], arr[MAX_N], dep, s[MAX_N << 2], col[MAX_N << 2],
    ans[MAX_N];
stack<int> st;
vector<int> vt[MAX_N];
void dfs(int rt, int fa) {
  in[rt] = ++dep;
  for (int i = 0; i < vt[rt].size(); i++) {
    int to = vt[rt][i];
    if (to == fa) continue;
    dfs(to, rt);
  }
  out[rt] = dep;
}
void up(int rt) { s[rt] = max(s[rt << 1], s[rt << 1 | 1]); }
void build(int rt, int l, int r) {
  col[rt] = 0;
  if (l == r) {
    s[rt] = 0;
    return;
  }
  int mid = (l + r) >> 1;
  build(rt << 1, l, mid);
  build(rt << 1 | 1, mid + 1, r);
  up(rt);
}
void down(int rt, int l, int r) {
  if (col[rt]) {
    int mid = (l + r) >> 1;
    col[rt << 1] += col[rt];
    col[rt << 1 | 1] += col[rt];
    s[rt << 1] += col[rt];
    s[rt << 1 | 1] += col[rt];
    col[rt] = 0;
  }
}
void update(int rt, int l, int r, int x, int y, int v) {
  if (x <= l && r <= y) {
    col[rt] += v;
    s[rt] += v;
    return;
  }
  int mid = (l + r) >> 1;
  down(rt, l, r);
  if (x <= mid) update(rt << 1, l, mid, x, y, v);
  if (mid < y) update(rt << 1 | 1, mid + 1, r, x, y, v);
  up(rt);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &arr[i]);
  build(1, 1, n + 1);
  for (int i = n; i >= 1; i--) {
    while (!st.empty() && arr[st.top()] <= arr[i]) st.pop();
    if (st.empty()) {
      vt[0].push_back(i);
    } else {
      vt[st.top()].push_back(i);
    }
    st.push(i);
  }
  dfs(0, -1);
  for (int i = n - m + 1; i <= n; ++i) update(1, 1, n + 1, in[i], out[i], 1);
  ans[n - m + 1] = s[1];
  for (int i = n - m; i >= 1; i--) {
    update(1, 1, n + 1, in[i + m], out[i + m], -1);
    update(1, 1, n + 1, in[i], out[i], 1);
    ans[i] = s[1];
  }
  for (int i = 1; i <= n - m + 1; ++i)
    i == n - m + 1 ? printf("%d\n", ans[i]) : printf("%d ", ans[i]);
  return 0;
}
