#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int N = 1e6 + 10;
const long long mod = 1e9 + 7;
const int bits = 20;
const long double pi = 3.14159265358979323846;
vector<int> adj[N];
int st[N], en[N], ptr;
void dfs(int node) {
  st[node] = ++ptr;
  for (int nxt : adj[node]) {
    dfs(nxt);
  }
  en[node] = ptr;
}
int tree[4 * N], lazy[4 * N];
void pushdown(int si, int ss, int se) {
  tree[si] += lazy[si];
  if (ss != se) {
    lazy[2 * si + 1] += lazy[si];
    lazy[2 * si + 2] += lazy[si];
  }
  lazy[si] = 0;
}
int query(int qs, int qe, int ss, int se, int si) {
  pushdown(si, ss, se);
  if (qs > se || qe < ss) {
    return -inf;
  }
  if (ss >= qs && se <= qe) {
    return tree[si];
  }
  int mid = (se + ss) / 2;
  return min(query(qs, qe, ss, mid, 2 * si + 1),
             query(qs, qe, mid + 1, se, 2 * si + 2));
}
void upd(int qs, int qe, int ss, int se, int si, int v) {
  pushdown(si, ss, se);
  if (qs > se || qe < ss || qs > qe) {
    return;
  }
  if (ss >= qs && se <= qe) {
    lazy[si] = v;
    pushdown(si, ss, se);
    return;
  }
  int mid = (se + ss) / 2;
  upd(qs, qe, ss, mid, 2 * si + 1, v);
  upd(qs, qe, mid + 1, se, 2 * si + 2, v);
  tree[si] = max(tree[2 * si + 1], tree[2 * si + 2]);
}
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> arr(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  stack<int> stk;
  for (int i = n; i >= 1; i--) {
    while (stk.size() && arr[stk.top()] <= arr[i]) stk.pop();
    if (stk.size()) {
      adj[stk.top()].push_back(i);
    } else {
      adj[n + 1].push_back(i);
    }
    stk.push(i);
  }
  dfs(n + 1);
  for (int i = 1; i <= k; i++) {
    upd(st[i], en[i], 0, ptr, 0, 1);
  }
  cout << tree[0] << " ";
  for (int i = k + 1; i <= n; i++) {
    upd(st[i], en[i], 0, ptr, 0, 1);
    upd(st[i - k], en[i - k], 0, ptr, 0, -1);
    cout << tree[0] << " ";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  std::cout << std::fixed << std::setprecision(20);
  ;
  int t = 1;
  while (t--) {
    solve();
  }
}
