#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <stack>
#include <list>

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,b,n) for(int i=b;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

const float PI = 3.1415926;
static const int INFTY = (1<<30);

using namespace std;

typedef long long ll;
typedef long double ld;


int n;
ll V[31], x;
ll maxn;

bool sosu(ll t){
  if(t == 1) return false;
  if(t == 2) return true;
  if(t%2 == 0) return false;

  for(ll i=3; i*i<=t; i+=2){
    if(t%i == 0) return false;
  }

  return true;
}

void solve(ll now) {
  if(now > x) return;
  if(sosu(now) && now > maxn)
    maxn = now;
  rep(i, n) {
    solve(now + V[i]);
  }
  return;
}

int main() {
  while(cin >> n >> x, n) {
    maxn = 0;
    rep(i, n) {
      cin >> V[i];
    }
    solve(0);
    if(maxn == 0) {
      cout << "NA" << endl;
    } else {
      cout << maxn << endl;
    }
  }

  return 0;
}