#include <iostream>

using namespace std;
int n, x, m, prises[30];
bool flag[1000001];

int sosuu(int n) {
	if (n == 2) return 1;
	if (n < 2 || n % 2 == 0) return 0;
	for (int i = 3; i * i <= n; i += 2)
			if (n % i == 0) return 0;
	return 1;
}

void max(int p) {
	if (p >= 1000000) return; 
	if (flag[p]) return;
	flag[p] = 1;
	for (int i = 0; i < n; ++i) {
		int k = p + prises[i];
		if (k > x) continue;
		if (k > m && sosuu(k)) m = k;
		max(k);
	}
}

int main() {
	for (;;) {
		for (int i = 0; i <= 1000000; ++i) flag[i] = 0;
		m = 0;
		cin >> n >> x;
		if (n == 0 && x == 0) break;
		for (int i = 0; i < n; ++i)
			cin >> prises[i];

		max(0);

		if (m) cout << m << endl;
		else cout << "NA" << endl;
	}
	return 0;
}