#include <bits/stdc++.h>
using namespace std;
int n, k, c, a[1000010], d[1000010], n1[1000010], n2[1000010], f1[1000010],
    f2[1000010], t[1000010];
bool v[1000010];
int main() {
  scanf("%d%d", &n, &k);
  if (k == 1) {
    for (int i = (1); i <= (n); ++i) printf("1 ");
    return 0;
  }
  for (int i = (1); i <= (n); ++i) scanf("%d", &a[i]);
  for (int i = n; i; --i) {
    while (c && d[c] <= a[i]) --c;
    d[++c] = a[i];
    a[i] = c;
    t[i] = i;
  }
  for (int i = (1); i <= (n); ++i) {
    int x = i - 1;
    for (; x && (a[x] > a[i] || a[t[x]] - a[x] <= a[t[i]] - a[i]); x = f2[x]) {
      int y = x;
      for (; y && a[t[i]] >= a[y]; y = f1[y]) v[y] = 1;
      if (y) {
        n1[y] = t[i];
        f1[t[i]] = y;
        t[i] = t[x];
      }
    }
    if (x)
      n2[x] = i, f2[i] = x;
    else
      c = i;
    if (i >= k) {
      printf("%d ", a[t[c]] - a[c] + 1);
      if (!v[i - k + 1]) {
        v[i - k + 1] = 1;
        t[c] = n1[i - k + 1];
        f1[n1[i - k + 1]] = 0;
        if (n2[c] && a[t[c]] - a[c] <= a[t[n2[c]]] - a[n2[c]]) {
          for (int j = i - k + 1; j; j = n1[j]) v[j] = 1;
          f2[n2[c]] = 0;
          c = n2[c];
        }
      }
    }
  }
}
