#include<bits/stdc++.h>
#define int long long
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
int n, x;
bool b[1010000];
vector<int>prime;
signed main() {
	prime.push_back(2);
	for (int i = 3; i < 999999; i += 2) {
		bool b00l = 0;
		for (int p : prime) {
			if (i % p == 0) { b00l = 1; break; }
			if (p > sqrt(i))break;
		}
		if (!b00l)prime.push_back(i);
	}
	while (cin >> n >> x, n) {
		for1(i, x)b[i] = 0;
		b[0] = 1;
		for1(gr4cv, n) {
			int p; cin >> p;
			for0(i, x)if (i + p > x)break; else if (b[i])b[i + p] = 1;
		}
		int ans = -1;
		for (int p : prime)if (p > x)break; else if (b[p])ans = p;
		if (ans < 0)cout << "NA\n";
		else cout << ans << endl;
	}
}
