#include <bits/stdc++.h>
using namespace std;
vector<int> v[65536 * 16];
int dep[65536 * 16];
int bel[65536 * 16];
int pa[65536 * 16];
int dfn[65536 * 16];
int siz[65536 * 16];
int DFN;
void dfs(int x, int rt) {
  if (!rt) rt = x;
  bel[x] = rt;
  dfn[x] = ++DFN;
  siz[x] = 1;
  for (int i = 0; i < v[x].size(); i++)
    dep[v[x][i]] = dep[x] + 1, dfs(v[x][i], rt), siz[x] += siz[v[x][i]];
}
int n;
int m;
int a[65536 * 16];
struct segmenttree {
  int tree[65536 * 16 * 2 + 10];
  int tag[65536 * 16 * 2 + 10];
  void init() {
    for (int i = 0; i < 65536 * 16 * 2 + 2; i++) tree[i] = -10000000;
  }
  void up(int x) {
    int id = x;
    tree[x] = max(tree[id << 1], tree[id << 1 | 1]);
  }
  void down(int x) {
    int id = x;
    tree[id << 1] += tag[x], tag[id << 1] += tag[x],
        tree[id << 1 | 1] += tag[x], tag[id << 1 | 1] += tag[x];
    tag[x] = 0;
  }
  void set(int x, int l, int r, int id, int y) {
    if (l == r) {
      tree[id] = y;
      return;
    }
    down(id);
    if (x <= (l + r) / 2)
      set(x, l, (l + r) / 2, id << 1, y);
    else
      set(x, (l + r) / 2 + 1, r, id << 1 | 1, y);
    up(id);
  }
  void upd(int a, int b, int l, int r, int id, int y) {
    if (l >= a and r <= b) {
      tree[id] += y;
      tag[id] += y;
      return;
    }
    down(id);
    if (a <= (l + r) / 2) upd(a, b, l, (l + r) / 2, id << 1, y);
    if (b > (l + r) / 2) upd(a, b, (l + r) / 2 + 1, r, id << 1 | 1, y);
    up(id);
  }
} trcyx;
void output() { printf("%d ", trcyx.tree[1]); }
void add(int x) {
  trcyx.set(dfn[x], 1, 65536 * 16, 1, 0);
  trcyx.upd(dfn[x], dfn[x] + siz[x] - 1, 1, 65536 * 16, 1, 1);
}
void sub(int x) { trcyx.set(dfn[x], 1, 65536 * 16, 1, -10000000); }
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  deque<int> dq;
  for (int i = n; i >= 1; i--) {
    while (dq.size() and a[dq.front()] <= a[i]) dq.pop_front();
    if (dq.size()) pa[i] = dq.front();
    dq.push_front(i);
  }
  trcyx.init();
  for (int i = 1; i <= n; i++) v[pa[i]].push_back(i);
  for (int i = 1; i <= n; i++)
    if (!pa[i]) dfs(i, 0);
  for (int i = 1; i <= m; i++) add(i);
  output();
  for (int i = m + 1; i <= n; i++) {
    add(i);
    sub(i - m);
    output();
  }
  return 0;
}
