#include <bits/stdc++.h>
using namespace std;
int tree[4 * 1000000 + 50];
int lazy[4 * 1000000 + 50];
inline void update(int node, int left, int right, int a, int b, int value) {
  int l = (node << 1);
  int r = (node << 1) + 1;
  if (lazy[node] != 0) {
    tree[node] += lazy[node];
    if (left != right) {
      lazy[l] += lazy[node];
      lazy[r] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (left > b || right < a) return;
  if (left >= a && right <= b) {
    tree[node] += value;
    if (left != right) {
      lazy[l] += value;
      lazy[r] += value;
    }
    return;
  }
  int mid = (left + right) >> 1;
  update(l, left, mid, a, b, value);
  update(r, mid + 1, right, a, b, value);
  tree[node] = max(tree[l], tree[r]);
  return;
}
inline int query(int node, int left, int right, int a, int b) {
  int l = (node << 1);
  int r = (node << 1) + 1;
  if (lazy[node] != 0) {
    tree[node] += lazy[node];
    if (left != right) {
      lazy[l] += lazy[node];
      lazy[r] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (left > b || right < a) return 0;
  if (left >= a && right <= b) return tree[node];
  int mid = (left + right) >> 1;
  int ret = max(query(l, left, mid, a, b), query(r, mid + 1, right, a, b));
  tree[node] = max(tree[l], tree[r]);
  return ret;
}
vector<int> vt[1000000 + 50];
int prnt[1000000 + 50];
int ans[1000000 + 50];
int a[1000000 + 50];
int l[1000000 + 50];
int r[1000000 + 50];
int cnt = 0;
inline void dfs(int u, int pre) {
  prnt[u] = pre;
  l[u] = ++cnt;
  for (int v : vt[u]) {
    dfs(v, u);
  }
  r[u] = cnt;
}
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    q;
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  a[n + 1] = n + 1;
  q.push(make_pair(n + 1, n + 1));
  for (int i = 1; i <= n + 1; i++) {
    while (q.top().first < a[i]) {
      vt[i].push_back(q.top().second);
      q.pop();
    }
    q.push(make_pair(a[i], i));
  }
  dfs(n + 1, -1);
  int s = n + 1;
  int e = n;
  for (int i = n; i - k + 1 > 0; i--) {
    int st = i - k + 1;
    while (st < s) {
      s--;
      int add = 1;
      if (prnt[s] != n + 1)
        add = query(1, 1, n + 1, l[prnt[s]], l[prnt[s]]) + 1;
      int koto = query(1, 1, n + 1, l[s], l[s]);
      update(1, 1, n + 1, l[s], r[s], add - koto);
    }
    while (e > i) {
      update(1, 1, n + 1, l[e], r[e], -1);
      e--;
    }
    ans[s] = query(1, 1, n + 1, 1, n + 1);
  }
  for (int i = 1; i + k - 1 <= n; i++) {
    if (i != 1) printf(" ");
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}
