#include <algorithm>
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

vector<int> prime_table(int n) {
    vector<int> is_prime(n + 1);
    if (n) iota(is_prime.begin() + 2, is_prime.end(), 2);
    for (int i = 2; i * i <= n; i++) if (is_prime[i]) {
        for (int j = i + i; j <= n; j += i) is_prime[j] = 0;
    }
    return is_prime;
}

int main() {
    auto is_prime = prime_table(1000000);
    int n, x;
    while (cin >> n >> x, n) {
        vector<int> vs(n);
        for (int &v: vs) cin >> v;
        vector<int> dp(x + 1, false); dp[0] = true;
        for (int i = 0; i < n; i++) for (int j = vs[i]; j <= x; j++) {
            dp[j] |= dp[j - vs[i]];
        }
        int ans = -1;
        for (int j = 0; j <= x; j++) if (dp[j]) {
            if (is_prime[j]) ans = j;
        }
        if (ans == -1) cout << "NA" << endl;
        else cout << ans << endl;
    }
    return 0;
}
