func_code_string: #include<bits/stdc++.h>   #define pb push_back   #define all(v) v.begin(),v.end()   #define allr(v) v.rbegin(),v.rend()   #define SORT(v) sort(all(v))   #define int long long   #define ff first   #define ss second   #define mod 1000000007      using namespace std;      void oj()   {     ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);     #ifndef ONLINE_JUDGE       freopen( input.txt ,  r , stdin);     freopen( output.txt ,  w , stdout);     #endif   }      void solve()   {     int n, k; cin>>n>>k;     vector<int>h(n);     vector<pair<int,int>>val;        for(int i = 0; i<n; i++)       cin>>h[i];        int mini = h[0];     int maxi = h[0] + k;        for(int i = 1; i<n - 1; i++){          if(h[i] + 2*k - 1 <= mini || h[i] >= maxi)       {         cout<< NO <<endl;          return;       }             maxi = min(maxi + k - 1LL, h[i] + 2 * k - 1LL);       mini = max(mini - k + 1LL, h[i] );        }        if(h[n-1] + k <= mini || h[n-1] >= maxi)     {       cout<< NO <<endl;         return;     }     cout<< YES <<endl;            }   signed main()   {     oj();     int t; cin>>t;     while(t--)       solve();        return 0;   }