#ifdef MYDEBUG
#include "pch.h"
#else
#include <bits/stdc++.h>
#endif
using namespace std;
typedef long long intl;
typedef vector<intl> vi;
typedef pair<intl, intl> pii;

#define println(arg) cout << arg << endl
#define print(arg) cout << arg
#define endln cout << endl
#define inputArr(arg) for (auto& e : arg) cin >> e;
#define printArr(arg) for (auto& e : arg) print(e << ' '); endln
#define all(x) (x).begin(),(x).end()

int main() 
{ 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	unsigned int t = 1;
	cin >> t;  /*LOOP*/
	void code();
	while (t--)	code();
}

constexpr intl mod = 1e9 + 7;
constexpr intl maxn = 1e6 + 1;

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

void code()
{
	intl n, k, g = 0;
	cin >> n >> k;
	vi a(n);
	inputArr(a);
	k -= a[0];
	for (size_t i = 1; i < n; i++)
		a[i] -= a[0];
	a[0] = 0;
	for (size_t i = 1; i < n; i++)
		g = gcd(a[i], g);
	if (k % g)
		println("NO");
	else
		println("YES");
}