#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#include <vector>

// int fun()



int main() {
	// your code goes here
	int t;
	cin>>t;
	
	while(t--)
	{
		int n,d;
		cin>>n>>d;
		vector<int> arr(n,0);
		for(int i=0;i<n;i++)
		{
			cin>>arr[i];
			// cout<<arr[i];
		}
		
		sort(arr.begin(),arr.end());
		int i,j,k;
		i=n-1;
		j=0,k=j+1;
		while(arr[i]>d)
		{
			if((arr[j]+arr[k])<=d)
			{
				arr[i--] =arr[j]+arr[k];
				
			}
			else
				break;
		}
		if(arr[i]<=d)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
	return 0;
}