#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int> PI;
#define MAX 1000009
ll m=0; int n=0; int ans=0;
bool flag;
vi v;
vb memo(MAX+10,true);
/*void dfs(int num){
    if(flag) return;
    if(ans==num){flag=true;return;}
    if(num>ans){memo[num]=false;return;}
    else rep(i,n){
        cout<<num<<endl;
      if(num+v[i]<=ans&&memo[num+v[i]])dfs(num+v[i]);
    }
    memo[num]=false;
    return;
}*/
int main(){
    vector<bool>check(MAX+1);  //index number will be checked
    rep(i, MAX+1)check[i] = true;
    vector<int>Primenumber(MAX+1,0); //Primearray
    int counter =0;                  //Primearray counter;
    for(int i = 2; i<MAX+1;i++){
        if(check[i]){
            for(int j = 2;i*j<MAX;j++)
                check[i*j] = false;//?´???°??????Primearray???????´??????????????????°?????¨???false???
            Primenumber[counter] = i;
            counter++;
        }
    }
    while(cin>>n>>m,n+m){
        int temp;
        flag=false;
        rep(i,n){cin>>temp; v.push_back(temp);}
        for(int i=(int)m;i>=0;i--){
            if(check[i]){
                ans=i;break;}
        }
        bool array[1000000]={false};
        rep(i,n)array[v[i]]=true;
        for(int i=1;i<=ans;i++) {
            if(array[i])rep(j,n)if(i+v[j]<=ans)array[i+v[j]]=true;
        }
        flag=array[ans];
        if(flag) cout<<ans<<endl;
        else cout<<"NA"<<endl;
        v.clear();
    }
}