#include<iostream>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
#define MC 1000001
using namespace std;
bool p[MC],V[MC]; int n,x,c[35],ans;
void rec(int a){
	rep(i,n)if(a+c[i]<x&&!V[a+c[i]])V[a+c[i]]=1,rec(a+c[i]);
}
int main(){
	for(int i=2;i*i<MC;i++)if(!p[i])for(int j=i+i;j<MC;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);
		fill(V,V+x,0); rec(0);
		for(ans=x;ans>=c[0];ans--)if(!p[ans]&&V[ans])break;
		if(ans<c[0])cout<<"NA"<<endl;
		else cout<<ans<<endl;
	}
	return 0;
}