#include <bits/stdc++.h>   using namespace std;   int n, p;   long long int a[100001];   int is_good(long long int q) {     int b[n];     for (int i = n - 1; i >= 0; i--) {       long long int l = max(a[i] - q, 0ll);       b[i] = n - l - (n - 1 - i);       if (b[i] % p == 0) return 0;     }     return 1;   }   int main() {     cin >> n >> p;     long long int maxx = 0;     for (int i = 0; i < n; ++i) {       cin >> a[i];       maxx = max(maxx, a[i]);     }     sort(a, a + n);     long long int t1 = 0;     for (int i = 0; i < n; i++) {       t1 = max(t1, a[i] - i);     }     long long int l = t1, r = 1000000001;     while (r > l) {       long long int mid = (r + l + 1) / 2;       if (is_good(mid)) {         l = mid;       } else {         r = mid - 1;       }     }     if (l == t1 && !is_good(l)) {       cout <<  0             <<   n ;       cout <<   n ;       exit(0);     }     cout << (l - t1 + 1) <<   n ;     for (long long int i = t1; i <= l; i++) {       cout << i <<    ;     }     cout <<   n ;   }   