#include<bits/stdc++.h>
using namespace std;

int Wm, N, W;
int w[1000];
bool dp[1000001];
deque< int > vc, newvc;
void rec( int mul){ // mul: 残りの重さ
  if(dp[mul]++) return;
  for(int i = 0; i < N; i++){
    if(mul + w[i] > W){
      newvc.push_back(mul + w[i]);
      continue;
    }
    rec(mul + w[i]);
  }
}
bool isprime(int& x){
  for(int i = 2 ; i * i <= x ; i++ ) if( x % i == 0) return true;
  return x == 1;
}
int solve(int i){
  while(i){
    if(dp[i] && !isprime(i)) return i;
    i--;
  }
  return 0;
}
int main(){

  while(cin >> N >> Wm, N){
    fill_n( dp, Wm + 1, false);
    for(int i = 0; i < N; i++){
      cin >> w[i];
    }
    vc.push_back(0);
    for(W = 1000 ; W < Wm; W += 1000){
      for(int i = 0; i < !vc.empty() ; i++){
        rec(vc.front());
        vc.pop_front();
      }
      vc = deque<int>(newvc.begin(),newvc.end());
      newvc.clear();
    }
    W = Wm;
    for(int i = 0; !vc.empty() ; i++){
      rec(vc.front());
      vc.pop_front();
    }
    newvc.clear();
    int ret = solve(W);
    if(ret == 0) cout << "NA" << endl;
    else cout << solve(W) << endl;
    vc.clear();
  }
}