#include #include using namespace std; using namespace atcoder; using ll=long long; using ld=long double; ld pie=3.141592653589793; ll mod=1000000007; ll inf=9999999999999999; int main(){ ll n,k; cin >> n >> k; vectora(n); for (ll i = 0; i < n; i++) { cin >> a[i]; } for (ll i = 0; i < n; i++) { if (a[i]==k) { cout << "Yes" << endl; return 0; } } sort(a.begin(),a.end()); vectorthr(21,1); for (ll i = 1; i < 21; i++) { thr[i]=thr[i-1]*3; } if (n>10) { mapmemo1; for (ll i = 0; i < 10; i++) { memo1[a[i]]=1; } ll d=n-10; for (ll i = 0; i < thr[10]; i++) { ll now=0; vectorz(3,0); for (ll j = 0; j <10 ; j++) { ll x=i%thr[j+1]; x/=thr[j]; if (x==0) { now+=a[j]; }else if (x==1) { now-=a[j]; } z[x]+=1; } if (z[0]==0||z[1]==0) { continue; } memo1[now]+=1; } mapmemo2; for (ll i = 0; i < d; i++) { memo2[a[10+i]]=1; } for (ll i = 0; i < thr[d]; i++) { ll now=0; vectorz(3,0); for (ll j = 0; j =1||memo2[k]>=1) { cout << "Yes" << endl; return 0; } for(auto v:memo1){ if (memo2[k+v.first]>=1||memo2[v.first-k]>=1) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; }else{ mapmemo1; for (ll i = 0; i < thr[n]; i++) { ll now=0; vectorz(3,0); for (ll j = 0; j =1) { cout << "Yes" << endl; }else{ cout << "No" << endl; } } }