//============================================================================
// Name        : DPpractice.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;

int n, x;
int v[55] = {0};
bool dp[55][1000005];
int p[1000005] = {0};

int main() {
	while(true){
	for(int i = 2; i < 1000005; i++){
		if(p[i] == 0){
			int now = 2;
			while(now * i < 1000005){
				p[i * now] = 1;
				now++;
			}
		}
	}
	cin >> n >> x;
	if(n == 0 && x == 0) return 0;
	std:memset(dp, false, sizeof(dp));
	for(int i = 0; i < n; i++) cin >> v[i];
	dp[0][0] = true;
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= x; j++){
			if(dp[i][j]){
				int now = 0;
				while(j + now * v[i] <= x){
					dp[i + 1][j + now * v[i]] = true;
					now++;
				}
			}
		}
	}
	int res = 0;
	for(int i = 2; i <= x; i++){
		if(dp[n][i]){
			if(p[i] == 0) res = i;
		}
	}
	if(res == 0){
		cout << "NA" << endl;
		continue;
	}
	cout << res << endl;
}
	return 0;
}

