#include <iostream>
#include <vector>
#include <stdio.h>
#include <string.h>
#include <map>
#include <fstream>
#include <stdlib.h>
using namespace std;
int t, n, m, num;
vector<int> arr;
bool vist[100001][101];
int vis[100001][101], id;
bool f[1101];
bool fact(int x) {
int cnt[2] = { }, sum = 0;
while (x % 2 == 0) {
x /= 2;
++sum;
}
cnt[sum % 2]++;
for (int i = 3; i * i <= x; i += 2) {
sum = 0;
while (x % i == 0) {
x /= i;
++sum;
}
cnt[sum % 2]++;
}
if (x > 1)
cnt[1]++;
return cnt[0] > cnt[1];
}
bool Ss(int x, int in) {
if (x == 0)
return 1;
if (x < 0 || in < 0)
return 0;
if (vis[x][in] == id)
return vist[x][in];
vis[x][in] = id;
return (vist[x][in] = Ss(x, in - 1) || Ss(x - arr[in], in - 1));
}
int main(int argc, char **argv) {
//freopen("a.in", "r", stdin);
f[0] = f[1] = 0;
for (int i = 2; i <= 1101; ++i)
f[i] = fact(i);
scanf("%d", &t);
while (t--) {
arr.clear();
scanf("%d%d", &n, &m);
for (int i = 0; i < n; ++i) {
scanf("%d", &num);
if (num <= m && f[num])
arr.push_back(num);
}
++id;
puts(Ss(m, arr.size()) ? "Yes" : "No");
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0cmluZy5oPgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8ZnN0cmVhbT4KI2luY2x1ZGUgPHN0ZGxpYi5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IHQsIG4sIG0sIG51bTsKdmVjdG9yPGludD4gYXJyOwpib29sIHZpc3RbMTAwMDAxXVsxMDFdOwppbnQgdmlzWzEwMDAwMV1bMTAxXSwgaWQ7CmJvb2wgZlsxMTAxXTsKCmJvb2wgZmFjdChpbnQgeCkgewoJaW50IGNudFsyXSA9IHsgfSwgc3VtID0gMDsKCXdoaWxlICh4ICUgMiA9PSAw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