#include <bits/stdc++.h>
using namespace std;
int ST[2100005];
int T[2100005 << 1], L[2100005 << 1];
vector<int> P[2100005];
int n, a[2100005], Nxt[2100005];
bool Vis[2100005];
int tot, St[2100005], Ed[2100005];
int IN() {
  int x = 0;
  char ch;
  for ((ch = getchar()); ch > '9' || ch < '0'; (ch = getchar()))
    ;
  for (; ch >= '0' && ch <= '9'; (ch = getchar())) (x *= 10) += ch - '0';
  return x;
}
void Modify(int x, int y) {
  for (; x; x -= x & -x) ST[x] = min(ST[x], y);
}
int Ask(int x) {
  int tmp = 0x3f3f3f3f;
  for (; x <= n; x += x & -x) tmp = min(tmp, ST[x]);
  return tmp;
}
void Dfs(int x) {
  Vis[x] = 1;
  St[x] = ++tot;
  for (auto v : P[x]) Dfs(v);
  Ed[x] = tot;
}
void Add(int l, int r, int y) {
  for (; l <= r; l >>= 1, r >>= 1) {
    if (l & 1) {
      L[l] += y;
      for (int z = l >> 1; z; z >>= 1)
        T[z] = max(T[z << 1] + L[z << 1], T[z << 1 | 1] + L[z << 1 | 1]);
      l++;
    }
    if (!(r & 1)) {
      L[r] += y;
      for (int z = r; z > 1; z >>= 1)
        T[z] = max(T[z << 1] + L[z << 1], T[z << 1 | 1] + L[z << 1 | 1]);
      r--;
    }
  }
}
int Lazy(int x) {
  int tmp = 0;
  for (; x; x >>= 1) tmp += L[x];
  return tmp;
}
int Query(int l, int r) {
  int tmp = 0;
  for (; l <= r; l >>= 1, r >>= 1) {
    if (l & 1) {
      tmp = max(tmp, T[l] + Lazy(l));
      l++;
    }
    if (!(r & 1)) {
      tmp = max(tmp, T[r] + Lazy(r));
      r--;
    }
  }
  return tmp;
}
int Len, ans[2100005], k;
int main() {
  n = IN();
  k = IN();
  memset(ST, 0x3f, sizeof(ST));
  for (int i = 1; i <= n; i++) a[i] = IN();
  for (int i = n; i; i--) {
    Modify(a[i], i);
    Nxt[i] = Ask(a[i] + 1);
    if (Nxt[i] != 0x3f3f3f3f) P[Nxt[i]].push_back(i);
  }
  for (int i = n; i; i--)
    if (!Vis[i]) Dfs(i);
  for (Len = 1; Len < n; Len <<= 1)
    ;
  for (int i = n; i >= n - k + 1; i--) Add(St[i] + Len - 1, Ed[i] + Len - 1, 1);
  ans[n - k + 1] = Query(Len, Len + n - 1);
  for (int i = n - k; i; i--) {
    Add(St[i] + Len - 1, Ed[i] + Len - 1, 1);
    Add(St[i + k] + Len - 1, Ed[i + k] + Len - 1, -1);
    ans[i] = Query(Len, Len + n - 1);
  }
  for (int i = 1; i <= n - k + 1; i++) printf("%d ", ans[i]);
}
