#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#define ll long long
using namespace std;
const int N=2e5+10;
ll v[N];
inline ll Abs(ll a){ return (a<0?-a:a); }
inline ll Gcd(ll a,ll b){ return b?Gcd(b,a%b):a; }
int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		int n; ll k,gcd=0;
		scanf("%d%lld",&n,&k);
		for(int i=1;i<=n;i++) scanf("%lld",&v[i]);
		for(int i=2;i<=n;i++) v[i]-=v[1];
		for(int i=2;i<=n;i++) gcd=Gcd(gcd,Abs(v[i]));
		if((k-v[1])%gcd==0) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}