#include <iostream>
#include <cstdio>
using namespace std;
#define sosu 1000001
bool so[sosu];
int n,x,c[31];
bool his[sosu];
int ans;

void hantei() {
  so[0] = so[1] = 1;
  for(int i=2;i*i<sosu;i++) 
    if(so[i] == 0) 
      for(int j=2;j<sosu/i;j++)so[i*j] = 1;
}


void saiki(int sum) {
  his[sum] = 1;
  if(so[sum] == 0 && ans < sum) ans = sum;
  
  for(int i=0;i<n;i++) 
    if(c[i] + sum <= x && his[c[i]+sum] == 0) 
      saiki(c[i]+sum);
}


int main() {
  hantei();

  while(1){
    cin >> n >> x;
    if(n == 0 && x == 0) break;
    
    for(int i=0;i<n;i++) cin >> c[i];
    for(int i=0;i<=x;i++) his[i] = 0;
    
    ans = -1;
    saiki(0);
    
    if(ans == -1) cout <<"NA"<<endl;
    else cout << ans << endl;
    
  }
  
  return 0;
}