#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
using namespace std;

const int INF = 1<<30;
bool isPrime[2000000],dp[2000000];

void Init(){
  for(int i=0;i<=2000000;i++)isPrime[i] = false;
  for(int i=3;i<=2000000;i+=2)isPrime[i] = true;
  isPrime[2] = true;
  int limit = (int)sqrt((double)2000000)+1;
  for(int i=3;i<=limit;i+=2){
    if(!isPrime[i])continue;
    for(int j=i+i;j<=2000000;j+=i)isPrime[j] = false;
  }
}


int main(){
  int n,x,val;
  vector<int> The_rock;
  Init();
  while(cin >> n >> x && n && x){
    The_rock.clear();
    for(int i=0;i<n;i++){
      cin >> val;
      The_rock.push_back(val);
    }
    //int dp[x+10];
  
    for(int i=0;i<=1000000;i++){
      //dp[i] = INF;
      dp[i] = false;
    }
    for(int i=0;i<The_rock.size();i++)dp[The_rock[i]] = true;
    //dp[0] = 0;
    dp[0] = true;
    for(int i=0;i<The_rock.size();i++){
      for(int j=The_rock[i];j+The_rock[i]<=1000000;j++){
	if(dp[j-The_rock[i]])dp[j] = true;
      }
    }
    bool fin = false;
    for(int i=x+9;i>=0;i--){
      if(isPrime[i] && dp[i]){
	cout << i << endl;
	fin = true;
	break;
      }
    }
    if(!fin)cout << "NA" << endl;


  }
  return 0;
}