#include<bits/stdc++.h>

using namespace std;

int Menu[30];
bool PrimeNumber[1000000], DpMoney[1000000];


void findPrimeNumber() {
	int limit;
	bool flag;

	memset(PrimeNumber, false, sizeof(PrimeNumber));
	PrimeNumber[2] = PrimeNumber[3] = true;

	for (int i = 5; i < 1000000; i += 2) {
		flag = true;
		limit = sqrt(i) + 1;
		for (int j = 2; j < limit; ++j) {
			if (i%j == 0) {
				PrimeNumber[i] = false;
				flag = false;
				break;
			}
		}
		if (!flag) {
			continue;
		}
		PrimeNumber[i] = true;
	}
}

void solve(int n, int max) {

	memset(DpMoney, false, sizeof(DpMoney));
	DpMoney[0] = true;

	for (int i = 0; i <= max; ++i) {
		for (int j = 0; j < n; ++j){
			if (DpMoney[i]) {
				if (i + Menu[j] > max) {
					continue;
				}
				DpMoney[i + Menu[j]] = true;
			}
		}
	}

	for (int i = max; i > 1; --i) {
		if (DpMoney[i] && PrimeNumber[i]) {
			cout << i << endl;
			return;
		}
	}
	cout << "NA" << endl;
}

int main() {
	int n, x, i;
	bool flag;

	findPrimeNumber();
	while (cin >> n >> x, n) {
		for (int i = 0; i < n; ++i) {
			cin >> Menu[i];
		}
		solve(n, x);
	}

	return 0;
}
