func_code_string: #include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   const unsigned long long MAX = LONG_MAX;   void fasterIO() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   int sumDig(int a) {     int sum = 0;     while (a != 0) {       sum += a % 10;       a /= 10;     }     return sum;   }   int main() {     int test;     cin >> test;     while (test--) {       long long p, k;       long long arr[150];       cin >> p >> k;       for (unsigned long long i = 0; i < (p); i++) cin >> arr[i];       sort(arr, arr + p);       if (abs((arr[0] + k) - arr[p - 1]) > k)         cout <<  -1  << endl;       else         cout << arr[0] + k << endl;     }     return 0;   }   