#include<iostream>
#include<algorithm>
#include<cstring>
#define M 1000001
using namespace std;

int n, x;
int data[33];
int prim[M];
int flg[M];
int p;

void solve(int i){

  if(i == n || p > x) return;
  if(flg[p]) return;
  
  solve(i+1);

  p += data[i];
  solve(i);
  p -= data[i];

  p += data[i];
  solve(i+1);
  p -= data[i];

  flg[p] = 1;
}


  
int main(){

  prim[0] = prim[1] = 1;
  for(int i=2;i*i<M;i++)
    if(!prim[i]) for(int j=i+i;j<M;j+=i) prim[j] = 1;

  for( ; ; ){
    cin >> n >> x;

    if(!n && !x) break;
    
    for(int i=0;i<n;i++) cin >> data[i];

    memset(flg, 0, sizeof(flg));
    p = 0;
    
    solve(0);
  
    int ans = -1;
    for(int i=0;i<=x;i++)
      if(!prim[i] && flg[i]) ans = i;

    if(ans == -1) cout << "NA\n";
    else cout << ans << endl;
  }

  
}