#include <bits/stdc++.h>
using namespace std;
bool f[1101], prime[1101];
int arr[101], ln, n, m, t;
vector<int> p;
void siv() {
prime[0] = prime[1] = 1;
int n = sqrt(1100);
for (int i = 4; i <= n; i += 2)
prime[i] = 1;
for (int i = 3; i * i <= n; i += 2) {
if (!prime[i])
for (int j = i * i; j <= n; j += i)
prime[j] = 1;
}
p.push_back(2);
for (int i = 3; i <= n; i += 2)
if (!prime[i])
p.push_back(i);
}
inline bool fact(int x) {
int cnt[2] = { }, sum = 0;
for (int i = 0, ln = p.size(); i < ln && p[i] * p[i] <= x; ++i) {
for (sum = 0; x % p[i] == 0; ++sum, x /= p[i])
;
cnt[sum % 2]++;
}
if (x > 1)
cnt[1]++;
return cnt[0] > cnt[1];
}
bool dp[100001][101] = { };
int Ss() {
for (int i = 0; i < ln; ++i)
dp[0][i] = 1;
for (int i = 1; i <= m; ++i) {
for (int j = 1; j <= ln; ++j) {
dp[i][j] = dp[i][j - 1];
if (i >= arr[j - 1])
dp[i][j] = dp[i][j] || dp[i - arr[j - 1]][j - 1];
}
}
return dp[m][ln];
}
int main() {
//freopen("a.in","r",stdin);
siv();
f[0] = f[1] = 0;
for (int i = 2; i <= 1101; ++i)
f[i] = fact(i);
int num;
scanf("%d", &t);
while (t--) {
ln = 0;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; ++i) {
scanf("%d", &num);
if (num <= m && f[num])
arr[ln++] = num;
}
puts(Ss() ? "Yes" : "No");
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpib29sIGZbMTEwMV0sIHByaW1lWzExMDFdOwppbnQgYXJyWzEwMV0sIGxuLCBuLCBtLCB0Owp2ZWN0b3I8aW50PiBwOwp2b2lkIHNpdigpIHsKCXByaW1lWzBdID0gcHJpbWVbMV0gPSAxOwoJaW50IG4gPSBzcXJ0KDExMDApOwoJZm9yIChpbnQgaSA9IDQ7IGkgPD0gbjsgaSArPSAyKQoJCXBy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