#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
vector<bool>prime_t(int n){
  vector<bool>prime(n + 1,true);
  if(n >= 0)prime[0] = false;
  if(n >= 1)prime[1] = false;
  for(int i = 2; i * i <= n; i++){
    if(!prime[i])continue;
    for(int j = i + i; j <= n; j += i)prime[j] = false;
  }
  return prime;
}
int main(){
  while(true){
    int n,x;
    cin >> n >> x;
    if(n == 0 && x == 0)return 0;
    vector<int>v(n);
    rep(i,n)cin >> v[i];
    auto P = prime_t(x);
    vector<bool>dp(x + 1,false);
    dp[0] = true;
    int ans = -1;
    rep(i,x + 1){
      if(!dp[i])continue;
      if(P[i])ans = max(ans,i);
      rep(j,n){
        if(i + v[j] > x)continue;
        dp[i + v[j]] = true;
      }
    }
    if(ans == -1)cout << "NA" << endl;
    else cout << ans << endl;
  }
  return 0;
}
