func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long t;     cin >> t;     while (t--) {       long long n, k, i;       cin >> n >> k;       long long a[n], s = INT_MAX, l = INT_MIN;       for (i = 0; i < n; i++) {         cin >> a[i];         s = min(s, a[i]);         l = max(l, a[i]);       }       if (s + k >= l - k)         cout << s + k << endl;       else         cout <<  -1  << endl;     }     return 0;   }   