func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     scanf( %d %d , &n, &k);     int a[500005];     map<int, vector<int>> m;     set<int> s;     for (int i = 0; i < n; i++) s.insert(i);     for (int i = 0; i < n; i++) {       scanf( %d , &a[i]);       m[a[i]].push_back(i);     }     int llast = n + k;     int last = n;     int cnt = 0;     for (auto it : m) {       if (!cnt && it.second[0] < last - k) {         auto it = s.lower_bound(llast - k);         if (it != s.end()) last = *it;         cnt = 1;       }       if (it.second[0] < last - k) {         printf( NO n );         return 0;       }       for (auto it2 : it.second) {         s.erase(it2);       }       llast = last;       last = min(it.second[0], last);     }     printf( YES n );   }   