func_code_string: #include <bits/stdc++.h>   using namespace std;   int cmpfunc(const void* a, const void* b) { return (*(int*)a - *(int*)b); }   int main() {     int A, B, i;     long long int sum = 0;     int a[100001] = {0};     cin >> A;     cin >> B;     for (i = 0; i < A; i++) {       cin >> a[i];     }     qsort(a, A, sizeof(int), cmpfunc);     for (i = 1; i < A; i++) {       if ((a[i] - a[0]) % B == 0)         sum = sum + (a[i] - a[0]) / B;       else {         sum = -1;         break;       }     }     cout << sum;     return 0;   }   