#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
template <typename T>
inline void read(T &x) {
  x = 0;
  bool sign = false;
  char ch = getchar();
  while (ch < '0' || '9' < ch) {
    sign |= ch == '-';
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  x = sign ? -x : x;
}
template <typename T>
inline void print(T x) {
  static char outp[128];
  int tot = 0;
  if (!x) {
    putchar('0');
    return;
  } else if (x < 0) {
    x = -x;
    putchar('-');
  }
  while (x) {
    outp[tot++] = x % 10, x /= 10;
  }
  while (tot) {
    putchar(outp[--tot] + 48);
  }
}
const int MAXN = 1e6 + 10;
struct Segtree {
  struct Node {
    int add, val;
    int stdl, stdr;
    Node() : add(0), val(0) {}
  } tree[((1 << 21) + 16)];
  inline void buildtree(int root, int l, int r) {
    tree[root].stdl = l;
    tree[root].stdr = r;
    if (l == r) return;
    buildtree((root << 1), l, ((tree[root].stdl + tree[root].stdr) >> 1));
    buildtree((root << 1 | 1), ((tree[root].stdl + tree[root].stdr) >> 1) + 1,
              r);
  }
  inline void buildtree(int r) { buildtree(1, 0, r + 1); }
  inline void pushdown(int root) {
    tree[(root << 1)].add += tree[root].add;
    tree[(root << 1)].val += tree[root].add;
    tree[(root << 1 | 1)].add += tree[root].add;
    tree[(root << 1 | 1)].val += tree[root].add;
    tree[root].add = 0;
  }
  inline void update(int root) {
    tree[root].val = max(tree[(root << 1)].val, tree[(root << 1 | 1)].val);
  }
  inline void add(int root, int l, int r, int p) {
    if (l <= tree[root].stdl && tree[root].stdr <= r) {
      tree[root].add += p;
      tree[root].val += p;
      return;
    }
    pushdown(root);
    if (l <= ((tree[root].stdl + tree[root].stdr) >> 1))
      add((root << 1), l, r, p);
    if (r >= ((tree[root].stdl + tree[root].stdr) >> 1) + 1)
      add((root << 1 | 1), l, r, p);
    update(root);
  }
  inline void add(int l, int r, int p) { add(1, l, r, p); }
} Tree;
int a[MAXN], n, k;
vector<int> edge[MAXN];
int bg[MAXN], ed[MAXN];
inline void dfs(int u) {
  static int T = 0;
  bg[u] = T++;
  for (auto v : edge[u]) {
    dfs(v);
  }
  ed[u] = T - 1;
}
int main() {
  read(n), read(k);
  for (register int i = 0; i <= n - 1; ++i) {
    read(a[i]);
  }
  stack<int> sta;
  for (register int i = n - 1; i >= 0; --i) {
    while (!sta.empty() && a[sta.top()] <= a[i]) sta.pop();
    edge[sta.empty() ? n : sta.top()].push_back(i), sta.push(i);
  }
  dfs(n);
  Tree.buildtree(n);
  for (register int i = 0; i <= k - 2; ++i) {
    Tree.add(bg[i], ed[i], 1);
  }
  for (register int i = 0; i <= n - k; ++i) {
    Tree.add(bg[i + k - 1], ed[i + k - 1], 1);
    print(Tree.tree[1].val), putchar(' ');
    Tree.add(bg[i], ed[i], -1);
  }
  putchar('\n');
  return 0;
}
