#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 10;
int tree[4 * maxn], lazy[4 * maxn], seen[maxn];
int N, K, A[maxn], in[maxn], out[maxn];
vector<int> graph[maxn];
int cnt = 0;
void dfs(int u, int p) {
  seen[u] = 1;
  for (auto &v : graph[u]) {
    if (v == p) continue;
    dfs(v, u);
  }
}
void dfs2(int u, int p) {
  in[u] = ++cnt;
  for (auto &v : graph[u]) {
    if (v == p) continue;
    dfs2(v, u);
  }
  out[u] = cnt;
}
void update(int node, int start, int end, int l, int r, int val) {
  if (lazy[node] != 0) {
    tree[node] += lazy[node];
    if (start != end) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (start > end || start > r || end < l) return;
  if (start >= l && end <= r) {
    tree[node] += val;
    if (start != end) {
      lazy[node * 2] += val;
      lazy[node * 2 + 1] += val;
    }
    return;
  }
  int mid = (start + end) / 2;
  update(node * 2, start, mid, l, r, val);
  update(node * 2 + 1, mid + 1, end, l, r, val);
  tree[node] = max(tree[node * 2], tree[node * 2 + 1]);
}
int query(int node, int start, int end, int l, int r) {
  if (start > end || start > r || end < l) return 0;
  if (lazy[node] != 0) {
    tree[node] += lazy[node];
    if (start != end) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (start >= l && end <= r) return tree[node];
  int mid = (start + end) / 2;
  int p1 = query(node * 2, start, mid, l, r);
  int p2 = query(node * 2 + 1, mid + 1, end, l, r);
  return max(p1, p2);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> K;
  for (int i = 1; i < N + 1; i++) cin >> A[i];
  stack<pair<int, int> > st;
  for (int i = N; i >= 1; i--) {
    while (st.size() && st.top().first <= A[i]) st.pop();
    if (st.size()) {
      graph[i].push_back(st.top().second);
      graph[st.top().second].push_back(i);
    }
    st.push({A[i], i});
  }
  for (int i = N; i >= 1; i--)
    if (!seen[i]) {
      dfs(i, i);
      graph[i].push_back(0);
      graph[0].push_back(i);
    }
  dfs2(0, 0);
  for (int i = 1; i < K + 1; i++) update(1, 1, cnt, in[i], out[i], 1);
  vector<int> res;
  res.push_back(query(1, 1, cnt, 1, cnt));
  for (int i = K + 1; i < N + 1; i++) {
    update(1, 1, cnt, in[i - K], out[i - K], -1);
    update(1, 1, cnt, in[i], out[i], 1);
    res.push_back(query(1, 1, cnt, 1, cnt));
  }
  for (auto &x : res) cout << x << ' ';
  cout << '\n';
  return 0;
}
