#include using namespace std; typedef long long ll; const ll INF = 1e18; const int MOD = 1e9 + 7; int main() { int t;cin>>t; while(t--){ ll n,k;cin>>n>>k; vector v(n); for(auto &a:v) cin>>a; sort(v.begin(),v.end()); v[0] -= k; ll ans = v[0]; for(int i=1;i