#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <map>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



bool isPrime(int a){	//must be a>1
	int maxI = floor(sqrt(a));
	FOR(i,2,maxI+1){
		if(a%i==0)return false;
	}
	return true;
}

int main(){
	while(true){
		MUNENIKAKETE:
		int dishL,maxYosan;
		cin >> dishL >> maxYosan;			if(!dishL&&!maxYosan) return 0;

		vector<int> dishS(dishL);
		REP(dishI,dishL){
			int dish;
			cin >> dish;
			dishS[dishI] = dish;
		}

		vector<bool> dekiru(maxYosan+1,false);
		dekiru[0] = true;
		REP(yosan,maxYosan+1){
			REP(dishI,dishL){
				int dish = dishS[dishI];
				if(yosan<dish) continue;
				dekiru[yosan] = dekiru[yosan] || dekiru[yosan - dish];
			}
		}

		for(int yosan = maxYosan; yosan>1 ; --yosan){
			if(dekiru[yosan]&&isPrime(yosan)){
				cout << yosan << endl;
				goto MUNENIKAKETE;
			}
		}
		cout << "NA" << endl;

	}
}