#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX / 3;
class SegmentTree {
 public:
  SegmentTree(int _n) : n(_n), N(_n << 1), data(N, 0), chgs(N, 0) {
    h = 0;
    while (1 << h <= N) {
      ++h;
    }
  }
  void build(vector<int>& nums) {
    assert(nums.size() <= n);
    int sz = nums.size();
    for (int i = 0; i < sz; ++i) {
      data[i + n] = nums[i];
    }
    for (int i = n - 1; i > 0; --i) {
      data[i] = max(data[i << 1], data[i << 1 | 1]);
    }
  }
  void apply(int x, int v) {
    data[x] += v;
    if (x < n) {
      chgs[x] += v;
    }
  }
  void pull(int x) {
    for (int p = x >> 1; p > 0; p >>= 1) {
      if (chgs[p] == 0) {
        data[p] = max(data[p << 1], data[p << 1 | 1]);
      }
    }
  }
  void push(int x) {
    for (int i = h; i >= 0; --i) {
      int p = x >> i;
      if (chgs[p] != 0) {
        apply(p << 1, chgs[p]);
        apply(p << 1 | 1, chgs[p]);
        chgs[p] = 0;
      }
    }
  }
  void update(int x, int v) {
    x += n;
    push(x);
    data[x] = v;
    pull(x);
  }
  void update(int l, int r, int v) {
    l += n;
    r += n;
    int ll = l, rr = r;
    push(ll);
    push(rr);
    while (l <= r) {
      if (l & 0x1) {
        apply(l++, v);
      }
      if ((r & 0x1) == 0) {
        apply(r--, v);
      }
      l >>= 1;
      r >>= 1;
    }
    pull(ll);
    pull(rr);
  }
  int get(int x) {
    x += n;
    push(x);
    return data[x];
  }
  int get(int l, int r) {
    l += n;
    r += n;
    push(l);
    push(r);
    int res = -INF;
    while (l <= r) {
      if (l & 0x1) {
        res = max(res, data[l++]);
      }
      if ((r & 0x1) == 0) {
        res = max(res, data[r--]);
      }
      l >>= 1;
      r >>= 1;
    }
    return res;
  }

 private:
  int n;
  int N;
  int h;
  vector<int> data;
  vector<int> chgs;
};
class Solution {
 public:
  vector<int> calc(vector<int>& nums, int n, int k) {
    vector<int> rights(n, n);
    vector<int> stk(n + 1);
    int sz = 0;
    for (int i = n - 1; i >= 0; --i) {
      while (sz > 0) {
        int j = stk[sz - 1];
        if (nums[j] <= nums[i]) {
          --sz;
        } else {
          break;
        }
      }
      rights[i] = sz == 0 ? n : stk[sz - 1];
      stk[sz++] = i;
    }
    vector<vector<int>> graph(n + 1);
    for (int i = 0; i < n; ++i) {
      graph[rights[i]].push_back(i);
    }
    int rt = n;
    vector<int> in(n + 1, 0);
    vector<int> out(n + 1, 0);
    int clk = -1;
    dfs(rt, -1, clk, graph, in, out);
    vector<int> vals(n + 1, -INF);
    SegmentTree st(n + 100);
    st.build(vals);
    vector<int> res;
    res.reserve(n - k + 1);
    for (int i = 0; i < n; ++i) {
      int idx = in[i];
      st.update(idx, 0);
      st.update(in[i], out[i], 1);
      if (i >= k) {
        st.update(in[i - k], -INF);
      }
      if (i + 1 >= k) {
        res.push_back(st.get(0, n));
      }
    }
    return res;
  }

 private:
  void dfs(int u, int p, int& clk, vector<vector<int>>& graph, vector<int>& in,
           vector<int>& out) {
    in[u] = ++clk;
    for (auto v : graph[u]) {
      if (v != p) {
        dfs(v, u, clk, graph, in, out);
      }
    }
    out[u] = clk;
  }
};
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  Solution sol;
  int n, k;
  cin >> n >> k;
  vector<int> nums(n);
  for (int i = 0; i < n; ++i) {
    cin >> nums[i];
  }
  auto res = sol.calc(nums, n, k);
  for (auto r : res) {
    cout << r << " ";
  }
  cout << "\n";
  return 0;
}
