感觉这样挺对的QAQ
int s1[7]={2,7,11,14,22,77,154};
int s2[5]={3,7,21,49,147};
int main() {
IOS;
T(){
map<int,int>mp1;
map<int,int>mp2;
int n;
cin>>n;
string k;
cin>>k;
int f=0;
vector<int>a(n+1,0);
ll ans=0;
for(int i=1;i<=n;i++){
cin>>a[i];
ans+=1ll*a[i];
}
if(k.size()<=17){
ll res=0;
for(char i : k){
res=res*10+i-'0';
}
if(ans>=res)f=1;
}
for(int i=1;i<=n;i++){
if(a[i]==0)continue;
if(a[i]%154==0)f=1;
if(a[i]%147==0)f=1;
for(int j=0;j<=6; j++){
if(a[i]%s1[j]==0){
int x=(154/s1[j]);
if(mp1.count(x))f=1;
}
}
for(int j=0 ;j<=6; j++){
if(a[i]%s1[j]==0){
mp1[s1[j]]=1;
}
}
for(int j=0 ;j<5; j++){
if(a[i]%s2[j]==0){
int x=(147/s2[j]);
if(mp2.count(x))f=1;
}
}
for(int j=0 ;j<5; j++){
if(a[i]%s2[j]==0){
mp2[s2[j]]=1;
}
}
if(f)break;
}
if(f)cout<<"Yes"<<endl;
else {
cout<<"No"<<endl;
}
}
return 0;
}