#include <stdio.h>
#include <algorithm>
using namespace std;
const int maxn = 200100;
long long a[maxn];
long long gcd (long long a, long long b) { return b == 0 ? a : gcd(b, a%b); }
int main() {
    int T; scanf("%d", &T);
    while (T--) {
        int n; long long K; 
        scanf("%d%lld", &n, &K);
        for (int i = 1; i <= n; ++i)
            scanf("%lld", &a[i]);
        sort(a + 1, a + 1 + n);
        long long d = a[2] - a[1];
        for (int i = 3; i <= n; ++i)
            d = gcd(d, a[i] - a[i-1]);
        printf("%s\n", (((K - a[1]) % d + d) % d) == 0 ? "YES" : "NO");
    }
    return 0;
}
