#include<iostream>
#include<algorithm>
#include<cstring>
#define SIZE 1000000
using namespace std;

bool data[SIZE];
int d[99];
int n, x;
bool memo[SIZE];
int ans;

bool solve(int s){

  if(s > x) return 0;
  if(memo[s]) return true;

  for(int i=0;i<n;i++){
    solve(s+d[i]);
    if(data[s]) ans = max(ans, s);
  }

  memo[s] = true;
  return true;
}

int main(){

  memset(data, true, sizeof(data));
  data[0] = data[1] = false;
  for(int i=2;i*i<SIZE;i++){
    if(data[i]) for(int j=i+i;j<SIZE;j+=i) data[j] = false;
  }

  while(true){
    cin >> n >> x;
    if(!n && !x) break;

    for(int i=0;i<n;i++) cin >> d[i];

    memset(memo, false, sizeof(memo));
    
    ans = 0;
    solve(0);
    if(ans) cout << ans;
    else cout << "NA";
    cout << endl;
  }
}