func_code_string: #include<bits/stdc++.h>   #define pairs pair<int,int>   #define loop(i,a,n) for(int i=a;i<n;i++)   #define m_p make_pair   #define fi first   #define se second   #define pb push_back   #define ll long long   #define all(v) v.begin(),v.end()   using namespace std;   //vector<ll> siz;   /*ll indes(ll i,ll right){       ll val=siz[i];       ll left=0;       ll ans=-1;       while(left<=right){           ll mid=(left+right)/2;           if(2*siz[mid]<=val){               ans=mid;               left=mid+1;           }           else           {               right=mid-1;           }                  }       return ans;    }*/   map<pairs,bool> mp;      void solve(){   ll n,k;   cin>>n>>k;   vector<ll> vec(n);   vector<pairs> range(n);   loop(i,0,n){       cin>>vec[i];   }   range[0].fi=vec[0];   range[0].se=vec[0];   range[n-1].fi=vec[n-1];   range[n-1].se=vec[n-1];   for(ll i=1;i<n-1;i++){     ll a=range[i-1].fi;     ll b=range[i-1].se;     ll c= b+k-1;     ll d=a-(k-1);     range[i].fi=max(d,vec[i]);     range[i].se=min(c,vec[i]+(k-1));   }      loop(i,1,n){     ll a=range[i-1].fi;     ll b=range[i-1].se;     ll c=range[i].fi;     ll d=range[i].se;        if(a-k>=d||b+k<=c){         cout<< NO ;         return;     }          }   cout<< YES ;   return;   }   int main(){       int test=1;       cin>>test;       while(test--){           solve();           cout<<endl;       }   }