#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
int a[1000000];
int m[1000000];

int isPrime(int x){
	if (x < 2)return 0;
	else if (x == 2) return 1;
	if (x % 2 == 0) return 0;
	for (int i = 3; i*i <= x; i += 2){
		if (x%i == 0) return 0;
	}
	return 1;
}


int main(){
	int n; int x;
	cin >> n >> x;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		m[a[i]] = 1;
	}
	for (int i = 0; i <= 15000; i++){
		if (m[i] > 0){
			for (int j = 0; j < n; j++){
				m[i + a[j]] = 1;
			}
		}
	}
	bool flag = false;
	for (int i = x; i >= 0; i--){
		if (m[i] > 0) {
			if (isPrime(i) == 1) {
				cout << i << endl;
				flag = true;
				break;
			}
		}
	}
	if (flag == false){
		cout << "NA" << endl;
	}
	return 0;
}