/******************************************
* AUTHOR : kevin_007 *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define Speed_UP  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define LL long long
#define N 100005
#define MOD 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define F first
#define S second

LL gcd (LL a, LL b) {
    if (b == 0)
        return a;
    else
        return gcd (b, a % b);
}


int main() {
    #ifndef ONLINE_JUDGE   
    freopen("input.txt", "r", stdin); 
    // freopen("output.txt", "w", stdout);    
    #endif 
    Speed_UP

    int t;
    cin>>t;

    while(t--){
        LL n,i=0,k;
        cin>>n>>k;

        LL a[n],g=0;

        rep(i,n) cin>>a[i];

        sort(a,a+n);

        rep1(i,n-1){
            g = gcd(g,a[i]-a[0]);
        }   

        if((k-a[0])%g == 0) cout<<"YES\n";
        else cout<<"NO\n";
    }
    
    
    return 0;
}