#include<iostream>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
#define MP 10000001
using namespace std;
bool p[MP]; int n,x,c[35],ans;
bool rec(int a,int s){
	int f=0;
	for(int i=s;i<n&&a>=c[i];i++)if(i>0||c[i]!=c[i-1]){
		if(a==c[i])return 1;
		else{
			f=rec(a-c[i],i);
			if(f) return 1;
		}
	}
	return f;
}
int main(){
	for(int i=2;i*i<MP;i++)if(!p[i])for(int j=i+i;j<MP;j+=i)p[j]=1;
	p[0]=p[1]=1;
	while(cin>>n>>x,n){
		rep(i,n)cin>>c[i]; sort(c,c+n);
		for(ans=x;ans>=c[0];ans--)if(!p[ans]&&rec(ans,0))break;
		if(ans<c[0])cout<<"NA"<<endl;
		else cout<<ans<<endl;
	}
	return 0;
}