#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define INF 999999999
#define all(v) begin(v), end(v)
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
    
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

#define int long long

int n, x;
vector<bool> pr(1000005, 0);

int prime(){
    pr[0] = pr[1] = 1;
    FOR(i, 2, 1000005){
        if(pr[i]) continue;
        
        for(int j = 2; i*j <= 1000000; j++){
            pr[i*j] = 1;
        }
    }
}

int solve(){
    vector<int> v(n);
    REP(i, n) cin >> v[i];
    VSORT(v);

    vector<bool> dp(x+5, 0);
    dp[0] = 1;
    FOR(i, 2, x+1){
        REP(j, n){
            if(i-v[j] >= 0 && dp[i-v[j]]) dp[i] = 1;
        }
    }
    
    REPR(i, x){
        if(dp[i] && !pr[i]){ 
           cout << i << endl;
           return 0;
        }
    }
    
    cout << "NA" << endl;
}

int32_t main(){
    prime();
    while(1){
        cin >> n >> x;
        if(!n) return 0;
        solve();
    }
}