func_code_string: #include <bits/stdc++.h>   using namespace std;   long long arr[200005], sh[200005], sp[200005];   int main() {     long long i, j, k, n, m, p, q, t, cnt = 0, mn;     scanf( %lld , &n);     scanf( %lld , &k);     for (i = 0; i < n; i++) {       scanf( %lld , &arr[i]);       ;     }     sort(arr, arr + n);     for (i = 0; i < n; i++) {       cnt = 0;       while (1) {         sh[arr[i]]++;         if (sh[arr[i]] <= k) sp[arr[i]] += cnt;         if (!arr[i]) break;         arr[i] /= 2;         cnt++;       }     }     mn = sp[0];     for (i = 0; i <= 200005; i++) {       if (sh[i] >= k && sp[i] < mn) mn = sp[i];     }     cout << mn << endl;     return 0;   }   