func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 105000;   int a[maxn], ans[maxn];   int n, p, res1, res2;   bool judge1(int k) {     int sum = 0;     for (int i = 1; i <= n; i++) {       if (a[i] <= k)         sum++;       else {         int tmp = a[i] - k;         sum -= tmp;         if (sum < 0) return 0;         k += tmp;         sum++;       }     }     return 1;   }   bool judge2(int k) {     int sum = 0;     for (int i = 1; i <= n; i++) {       if (a[i] <= k) {         sum++;         if (sum >= p) return 0;       } else {         int tmp = a[i] - k;         sum -= tmp;         k += tmp;         sum++;       }     }     return 1;   }   void solve() {     scanf( %d %d , &n, &p);     int max_v = 0;     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       max_v = max(max_v, a[i]);     }     sort(a + 1, a + n + 1);     int l = 1, r = max_v;     while (l <= r) {       int mid = l + r >> 1;       if (judge1(mid))         r = mid - 1;       else         l = mid + 1;     }     res1 = l;     r = max_v;     while (l <= r) {       int mid = l + r >> 1;       if (judge2(mid))         l = mid + 1;       else         r = mid - 1;     }     res2 = r;     printf( %d n , res2 - res1 + 1);     for (int i = res1; i <= res2; i++) printf( %d  , i);     printf(  n );   }   int main() {     solve();     return 0;   }   