#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)

const int MAX_N = 1000 * 1000 + 10;
bool isPrime[MAX_N];

void makePrimes() {
  REP(i, MAX_N) isPrime[i] = true;
  isPrime[0] = isPrime[1] = false;
  for (int i = 2; i * i < MAX_N; i++)
      if (isPrime[i])
          for (int j = i * i; j < MAX_N; j += i)
              isPrime[j] = false;
}

bool can[MAX_N];

int main() {
  makePrimes();

  for (int N, X; cin >> N >> X, (N || X); ) {
      memset(can, 0, sizeof(can));
      can[0] = true;
      REP(i, N) {
          int a; cin >> a;
          for (int p = 0; p + a <= X; p++)
              if (can[p]) can[p + a] = true;
      }

      int ans = -1;
      for (int i = 0; i <= X; i++)
          if (isPrime[i] && can[i])
              ans = i;
      if (ans == -1)
          cout << "NA" << endl;
      else
          cout << ans << endl;
  }
  return 0;
}