#include<bits/stdc++.h>
using namespace std;
#define Maxn 200005
typedef long long ll;
int t,n;
ll k,g,x[Maxn];
bool cmp(ll a,ll b)
{
	 return a<b;
}
ll gcd(ll a,ll b){ return (b==0ll)?a:gcd(b,a%b); }
int main()
{
     //freopen(".in","r",stdin);
     //freopen(".out","w",stdout);
	 scanf("%d",&t);
	 while(t--)
	 {
	 	 scanf("%d%lld",&n,&k),g=0ll;
	 	 for(int i=1;i<=n;i++) scanf("%lld",&x[i]);
	 	 sort(x+1,x+n+1,cmp);
	 	 for(int i=2;i<=n;i++) g=gcd(g,x[i]-x[1]);
	 	 if((k-x[1])%g) printf("NO\n");
	 	 else printf("YES\n");
	 }
     //fclose(stdin);
     //fclose(stdout);
     return 0;
}