func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MOD = (1e9 + 7);   const long long INF = (1e9 + 123456789);   const long long INFL = (INF * INF);   inline long long addm(long long a, long long b, long long m = MOD) {     return ((a + b) % m);   }   inline long long subm(long long a, long long b, long long m = MOD) {     return (((a - b) % m + m) % m);   }   inline long long mulm(long long a, long long b, long long m = MOD) {     return ((a * b) % m);   }   long long powm(long long a, long long b, long long m = MOD) {     long long ret = (!b) ? 1 : powm(a, b / 2, m);     return (!b) ? 1 : mulm(mulm(ret, ret, m), b % 2 ? a : 1, m);   }   long long gcd(long long a, long long b) { return (!b) ? a : gcd(b, a % b); }   long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }   long long inv(long long x, long long m = MOD) { return powm(x, m - 2, m); }   const int N = 1000500;   int a[N], lft[N], nxt[N];   vector<int> nodes, g[N];   struct SegmentTree {     int f, t;     SegmentTree *lc, *rc;     bool has_child, has_lazy = false;     int upd = 0;     int vmax = 0;     SegmentTree(int l, int r) {       if (l == r) {         f = t = l;         lc = rc = NULL;         has_child = false;       } else {         f = l;         t = r;         int mid = (l + r) / 2;         lc = new SegmentTree(l, mid);         rc = new SegmentTree(mid + 1, r);         has_child = true;       }     }     void change(int v) {       vmax += v;       upd += v;       has_lazy = true;     }     void push() {       if (!has_lazy) return;       lc->change(upd);       rc->change(upd);       upd = 0;       has_lazy = false;     }     void update(int l, int r, int x) {       if (r < f || l > t) return;       if (l <= f && t <= r) {         change(x);         return;       }       push();       lc->update(l, r, x);       rc->update(l, r, x);       vmax = max(lc->vmax, rc->vmax);     }     int query(int l, int r) {       if (r < f || l > t) return 0;       if (l <= f && t <= r) return vmax;       return vmax = max(lc->query(l, r), rc->query(l, r));     }   };   void solve() {     int n, k;     cin >> n >> k;     for (int i = 0; i < n; i++) cin >> a[i];     stack<int> st;     for (int i = n - 1; i >= 0; i--) {       while (!st.empty() && a[st.top()] <= a[i]) st.pop();       if (!st.empty())         nxt[i] = st.top();       else         nxt[i] = n;       st.push(i);     }     for (int i = 0; i < n; i++) g[nxt[i]].push_back(i);     function<void(int)> post = [&](int v) {       int l = (int)(nodes).size();       for (int u : g[v]) post(u);       lft[(int)(nodes).size()] = l;       nodes.push_back(v);     };     post(n);     SegmentTree root(0, n);     for (int i = 0; i < k; i++) root.update(lft[i], i, 1);     vector<int> ans;     ans.push_back(root.query(0, n));     for (int i = k; i < n; i++) {       root.update(lft[i - k], i - k, -1);       root.update(lft[i], i, 1);       ans.push_back(root.query(0, n));     }     for (int i = 0; i < (int)(ans).size(); i++) {       if (i) cout <<    ;       cout << ans[i];     }     cout <<   n ;   }   int main(int argc, char *argv[]) {     cin.sync_with_stdio(0);     cin.tie(NULL);     solve();     return 0;   }   