#include<iostream>
#include<algorithm>
using namespace std;
bool dp[1000001]={true},prime[1000001]={true,true};
int solve(int &i){
  while(i--) if(dp[i] && !prime[i]) return i;
}
int main(){
  int n,x,data[30],ans;
  for(int i = 2 ; i * i <= 1000001 ; i++ ){
    if(!prime[i]) for(int j = 2 ; i * j < 1000001 ; j++ ) prime[i*j] = true;
  }
  while(cin >> n >> x , n){
    for(int i = 1 ; i <= x ; i++ ) dp[i] = false;
    for(int i = 0 ; i < n ; i++ ) cin >> data[i];
    for(int i = 0 ; i <= x ; i++ ){
      if(dp[i]) for(int j = 0 ; j < n ; j++ )
        if(i+data[j] <= x) dp[i+data[j]] = true;
    }
    if(ans = solve(x)) cout << ans << endl;
    else cout << "NA" << endl;
  }
}