#include <bits/stdc++.h>
using namespace std;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1, -1, 1, -1, 0, 0, -1, 1};
const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9 + 7;
const int maxn = (int)1e6 + 5;
const int LOGN = 20;
int tree[4 * maxn], lazy[4 * maxn];
void propagate(int node, int b, int e) {
  if (lazy[node] == 0) return;
  tree[node] += lazy[node];
  if (b != e) {
    lazy[2 * node] += lazy[node];
    lazy[2 * node + 1] += lazy[node];
  }
  lazy[node] = 0;
}
int query(int node, int b, int e, int l, int r) {
  propagate(node, b, e);
  if (l > e || r < b) return 0LL;
  if (b >= l && e <= r) return tree[node];
  int Left = node * 2;
  int Right = node * 2 + 1;
  int mid = (b + e) / 2;
  return max(query(Left, b, mid, l, r), query(Right, mid + 1, e, l, r));
}
void update(int node, int b, int e, int l, int r, int add) {
  propagate(node, b, e);
  if (l > e || r < b) return;
  if (b >= l && e <= r) {
    lazy[node] = add;
    propagate(node, b, e);
    return;
  }
  int Left = node * 2;
  int Right = node * 2 + 1;
  int mid = (b + e) / 2;
  update(Left, b, mid, l, r, add);
  update(Right, mid + 1, e, l, r, add);
  tree[node] = max(tree[Left], tree[Right]);
}
int a[maxn], ans[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<int> v;
  v.push_back(0);
  a[0] = INT_MAX;
  for (int i = 1; i <= (n); i++) {
    cin >> a[i];
    while (!v.empty() && a[i] > a[v.back()]) v.pop_back();
    update(1, 1, n, v.back() + 1, i, +1);
    v.push_back(i);
    if (i >= k) ans[i] = query(1, 1, n, i - k + 1, i);
  }
  for (int i = (k); i <= (n); i++) cout << ans[i] << " ";
  return 0;
}
