#include <bits/stdc++.h>
using namespace std;
template <class T>
using v2d = vector<vector<T> >;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int maxN = 1e6 + 10;
const int inf = 1e9;
int n, k, a[maxN], p[maxN], start[maxN], finish[maxN], h[maxN], s, ans[maxN],
    f[maxN * 4], lazy[maxN * 4], L, R, idx, val;
stack<int> st;
vector<int> adj[maxN];
void down(int x) {
  int t = lazy[x];
  if (t != 0) {
    lazy[x] = 0;
    lazy[x * 2] += t;
    lazy[x * 2 + 1] += t;
    f[x * 2] += t;
    f[x * 2 + 1] += t;
  }
}
void update_r(int x, int lo, int hi) {
  if (lo > R || hi < L) {
    return;
  }
  if (lo >= L && hi <= R) {
    f[x] += val;
    lazy[x] += val;
    return;
  }
  down(x);
  int mid = (lo + hi) / 2;
  update_r(x * 2, lo, mid);
  update_r(x * 2 + 1, mid + 1, hi);
  f[x] = max(f[x * 2], f[x * 2 + 1]);
}
void update_p(int x, int lo, int hi) {
  if (lo == hi && lo == idx) {
    f[x] = val;
    return;
  }
  down(x);
  int mid = (lo + hi) / 2;
  if (idx <= mid) {
    update_p(x * 2, lo, mid);
  } else {
    update_p(x * 2 + 1, mid + 1, hi);
  }
  f[x] = max(f[x * 2], f[x * 2 + 1]);
}
int query(int x, int lo, int hi) {
  if (lo > R || hi < L) {
    return -inf;
  }
  if (lo >= L && hi <= R) {
    return f[x];
  }
  down(x);
  int mid = (lo + hi) / 2;
  return max(query(x * 2, lo, mid), query(x * 2 + 1, mid + 1, hi));
}
void dfs(int u, int d) {
  start[u] = ++s;
  h[u] = d;
  for (auto &v : adj[u]) {
    dfs(v, d + 1);
  }
  finish[u] = s;
}
void solve() {
  cin >> n >> k;
  for (int i = 1; i <= (int)(n); ++i) {
    cin >> a[i];
  }
  for (int i = n; i; i--) {
    while (!st.empty() && a[st.top()] <= a[i]) {
      st.pop();
    }
    p[i] = (st.empty() ? n + 1 : st.top());
    adj[p[i]].emplace_back(i);
    st.push(i);
  }
  dfs(n + 1, 1);
  for (int i = (int)(n - k + 2); i <= (int)(n + 1); ++i) {
    L = R = start[i], val = h[i];
    update_r(1, 1, s);
  }
  for (int i = n - k + 1; i; i--) {
    L = start[i + k], R = finish[i + k], val = -1;
    update_r(1, 1, s);
    int d = 1;
    if (p[i] < i + k) {
      L = R = start[p[i]];
      d += query(1, 1, s);
    }
    idx = start[i], val = d;
    update_p(1, 1, s);
    ans[i] = f[1];
  }
  for (int i = 1; i <= (int)(n - k + 1); ++i) {
    cout << ans[i] << " ";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
