#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	vi isprime(1000001,1);
	isprime[0]=isprime[1]=0;
	repi(i,2,isprime.size())
		if(isprime[i])
			for(int j=i+i;j<isprime.size();j+=i)
				isprime[j]=0;
	for(int n,x;cin>>n>>x,n|x;){
		vi price(n);
		rep(i,n)
			cin>>price[i];
		vi dp(x+1);
		dp[0]=1;
		rep(i,n)
			repi(j,price[i],dp.size())
				if(dp[j-price[i]])
					dp[j]=1;
		bool flg=false;
		rep(i,dp.size())
			if(dp[x-i] && isprime[x-i]){
				printf("%d\n",x-i);
				flg=true;
				break;
			}
		if(!flg)
			puts("NA");
	}
	
	return 0;
}