#include <bits/stdc++.h>
using namespace std;
const long long int INF = 9223372036854775807;
int MOD(int a, int b) {
  if (a > b)
    return a - b;
  else
    return b - a;
}
int max3(int a, int b, int c) { return max(c, max(a, b)); }
int min3(int a, int b, int c) { return min(a, min(b, c)); }
long long int power(long long int x, long long int y) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res % 1000000007;
}
long long int logg(long long int a) {
  long long int x = 0;
  while (a > 1) {
    x++;
    a /= 2;
  }
  return x;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int abso(long long int x) {
  if (x < 0) {
    return -x;
  }
  return x;
}
long long int ceiling(long long int a, long long int b) {
  if (a % b == 0) {
    return a / b;
  } else {
    return a / b + 1;
  }
}
long long int modinv(long long int x) { return power(x, 1000000007 - 2); }
vector<int> cnt;
vector<int> r;
int n, k;
vector<int> a;
int start;
int fin;
vector<int> ans;
vector<int> tree;
vector<int> lazy;
void build(int node, int start, int end) {
  if (start == end) {
    tree[node] = ans[start];
  } else {
    int mid = (start + end) / 2;
    build(2 * node, start, mid);
    build(2 * node + 1, mid + 1, end);
    tree[node] = max(tree[2 * node], tree[2 * node + 1]);
  }
}
void del(int ind) {
  if (fin <= n + 1 && r[fin] == ind) {
    cnt[fin] = INF;
    r[fin] = -1;
    fin--;
  }
}
int add(int ind) {
  int temp_index =
      lower_bound(cnt.begin() + start, cnt.begin() + fin, a[ind]) - cnt.begin();
  temp_index--;
  start = temp_index;
  cnt[start] = a[ind];
  r[start] = ind;
  if (start + 1 >= cnt.size() || cnt[start + 1] == INF) {
    return r[start] - k + 1;
  } else {
    return r[start + 1] + 1;
  }
}
void updateRange(int node, int start, int end, int l, int r, int val) {
  if (lazy[node] != 0) {
    tree[node] += lazy[node];
    if (start != end) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (start > end or start > r or end < l) return;
  if (start >= l and end <= r) {
    tree[node] += val;
    if (start != end) {
      lazy[node * 2] += val;
      lazy[node * 2 + 1] += val;
    }
    return;
  }
  int mid = (start + end) / 2;
  updateRange(node * 2, start, mid, l, r, val);
  updateRange(node * 2 + 1, mid + 1, end, l, r, val);
  tree[node] = max(tree[node * 2], tree[node * 2 + 1]);
}
int queryRange(int node, int start, int end, int l, int r) {
  if (start > end or start > r or end < l) return 0;
  if (lazy[node] != 0) {
    tree[node] += lazy[node];
    if (start != end) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (start >= l and end <= r) return tree[node];
  int mid = (start + end) / 2;
  int p1 = queryRange(node * 2, start, mid, l, r);
  int p2 = queryRange(node * 2 + 1, mid + 1, end, l, r);
  return (max(p1, p2));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n >> k;
  start = n + 2;
  fin = n + 2;
  a.resize(n);
  tree.resize(4 * n + 50);
  lazy.resize(4 * n + 50);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cnt.resize(n + 2, -1);
  ans.resize(n, 0);
  r.resize(n + 2, -1);
  build(1, 0, n - 1);
  for (int i = 0; i < k; i++) {
    int ind = add(i);
    updateRange(1, 0, n - 1, max(0, ind), i, 1);
  }
  cout << queryRange(1, 0, n - 1, 0, k - 1) << ' ';
  for (int i = 1; i + k - 1 < n; i++) {
    del(i - 1);
    int cur_index = add(i + k - 1);
    updateRange(1, 0, n - 1, max(0, cur_index), min(n - 1, i + k - 1), 1);
    cout << queryRange(1, 0, n - 1, i, i + k - 1) << ' ';
  }
}
