#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
using namespace std;
const int N = 1e6 + 10;
int nxt[N];
pair<int, int> seg[N * 4];
int mp[N];
void upd(int nod, int l, int r, int id, int val) {
  if (r - l == 1) {
    seg[nod] = {mp[l], val};
    return;
  }
  int mid = (r + l) / 2;
  if (mid > id)
    upd(nod * 2, l, mid, id, val);
  else
    upd(nod * 2 + 1, mid, r, id, val);
  seg[nod].second = max(seg[nod * 2].second, seg[nod * 2 + 1].second);
  if (seg[nod].second == seg[nod * 2].second)
    seg[nod] = seg[nod * 2];
  else
    seg[nod] = seg[nod * 2 + 1];
  return;
}
pair<int, int> get(int nod, int l, int r, int L, int R) {
  if (l >= R || L >= r) return {0, 0};
  if (l >= L && r <= R) return seg[nod];
  int mid = (r + l) / 2;
  pair<int, int> a = get(nod * 2, l, mid, L, R);
  pair<int, int> b = get(nod * 2 + 1, mid, r, L, R);
  if (a.second > b.second) return a;
  return b;
}
vector<int> g[N];
int st[N], fn[N], hi[N], ts = 1;
void dfs(int v, int p, int h) {
  st[v] = ts;
  hi[v] = h;
  for (auto u : g[v]) {
    if (u == p) continue;
    ts++;
    dfs(u, v, h + 1);
  }
  fn[v] = ts;
}
int a[N];
set<pair<int, int> > s;
int par[N];
int ans[N];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  a[n + 1] = n + 1;
  vector<int> agh;
  agh.push_back(n + 1);
  for (int i = n; i; i--) {
    while (a[agh.back()] <= a[i]) agh.pop_back();
    nxt[i] = agh.back();
    g[nxt[i]].push_back(i);
    agh.push_back(i);
  }
  dfs(n + 1, n + 1, 1);
  for (int i = 1; i <= n + 1; i++) mp[st[i]] = i;
  for (int i = 1; i <= k; i++) {
    upd(1, 1, N, st[i], hi[i]);
    pair<int, int> t = get(1, 1, N, st[i], fn[i] + 1);
    for (auto u : g[i]) {
      s.erase({ans[u], u});
      ans[u] = -1;
    }
    par[t.first] = i;
    ans[i] = t.second - hi[i];
    s.insert({ans[i], i});
  }
  for (int i = k + 1; i <= n + 1; i++) {
    cout << s.rbegin()->first + 1 << " ";
    int p = par[i - k];
    s.erase({ans[p], p});
    upd(1, 1, N, st[i - k], 0);
    if (p > i - k && ans[p] != -1) {
      pair<int, int> z = get(1, 1, N, st[p], fn[p] + 1);
      par[z.first] = p;
      ans[p] = z.second - hi[p];
      s.insert({ans[p], p});
    }
    upd(1, 1, N, st[i], hi[i]);
    pair<int, int> z = get(1, 1, N, st[i], fn[i] + 1);
    for (auto u : g[i]) {
      s.erase({ans[u], u});
      ans[u] = -1;
    }
    par[z.first] = i;
    ans[i] = z.second - hi[i];
    s.insert({ans[i], i});
  }
}
