#include <bits/stdc++.h>
using namespace std;
const int N = 1000006;
const int inf = 1000000009;
int n, k, a[N], go[N], in[N], out[N], tin = 0;
vector<int> g[N];
template <class T>
struct lazy_seg {
 public:
  vector<T> st, lazy;
  lazy_seg(int n) { st.resize(4 * n + 1, 0), lazy.resize(4 * n + 1, 0); }
  lazy_seg() = default;
  void push(int l, int r, int curr) {
    if (lazy[curr] != 0) {
      st[curr] += lazy[curr];
      if (l != r)
        lazy[2 * curr] += lazy[curr], lazy[2 * curr + 1] += lazy[curr];
      lazy[curr] = 0;
    }
  }
  void pull(int l, int r, int curr) {
    push(l, r, curr);
    int mid = l + (r - l) / 2;
    if (l != r) push(l, mid, 2 * curr), push(mid + 1, r, 2 * curr + 1);
    st[curr] = max(st[2 * curr], st[2 * curr + 1]);
  }
  void upd(int x, int y, T v, int l, int r, int curr) {
    int mid = (l + r) / 2;
    push(l, r, curr);
    if (l == x && r == y) {
      lazy[curr] += v;
      push(l, r, curr);
      return;
    }
    if (y <= mid)
      upd(x, y, v, l, mid, 2 * curr);
    else if (x > mid)
      upd(x, y, v, mid + 1, r, 2 * curr + 1);
    else
      upd(x, mid, v, l, mid, 2 * curr),
          upd(mid + 1, y, v, mid + 1, r, 2 * curr + 1);
    pull(l, r, curr);
  }
  T qry(int x, int y, int l, int r, int curr) {
    int mid = (l + r) / 2;
    push(l, r, curr);
    if (l == x && r == y) return st[curr];
    if (y <= mid)
      return qry(x, y, l, mid, 2 * curr);
    else if (x > mid)
      return qry(x, y, mid + 1, r, 2 * curr + 1);
    return max(qry(x, mid, l, mid, 2 * curr),
               qry(mid + 1, y, mid + 1, r, 2 * curr + 1));
  }
  void build(int l, int r, int curr) {
    int mid = (l + r) / 2;
    if (l == r) {
      st[curr] = 0;
      return;
    }
    build(l, mid, 2 * curr);
    build(mid + 1, r, 2 * curr + 1);
    st[curr] = (st[2 * curr] + st[2 * curr + 1]);
  }
};
bool vis[N];
void dfs(int x) {
  vis[x] = true;
  in[x] = ++tin;
  for (auto w : g[x]) {
    if (!vis[w]) dfs(w);
  }
  out[x] = tin;
}
int32_t main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  stack<int> cur;
  lazy_seg<int> seg(n);
  for (int i = n; i >= 1; i--) {
    while ((int)(cur).size() && a[i] >= a[cur.top()]) cur.pop();
    if ((int)(cur).size()) {
      g[i].push_back(cur.top());
      g[cur.top()].push_back(i);
    }
    cur.push(i);
  }
  for (int i = n; i >= 1; i--) {
    if (!vis[i]) {
      dfs(i);
    }
  }
  for (int i = 1; i <= n; i++) {
    if (i > k) {
      seg.upd(in[i - k], out[i - k], -1, 1, n, 1);
    }
    seg.upd(in[i], out[i], 1, 1, n, 1);
    if (i >= k) {
      printf("%d ", seg.qry(1, n, 1, n, 1));
    }
  }
  printf("\n");
}
