func_code_string: #include <bits/stdc++.h>   using namespace std;   long long a[1000000];   int main() {     long long i, num, res = 0, n, k, rem, fl = 0;     cin >> n >> k;     for (i = 0; i < n; i++) {       cin >> a[i];     }     sort(a, a + n);     for (i = 1; i < n; i++) {       if ((a[i] - a[0]) % k != 0) {         fl = 1;         break;       } else {         rem = (a[i] - a[0]) / k;         res += rem;       }     }     if (fl) {       cout << -1 << endl;     } else       cout << res << endl;     return 0;   }   