#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

const int SIZE = 1000010;
int n, x;
int v[30];
bool dp[SIZE];
bool is_prime[SIZE];
vector<int> p;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  fill_n((bool*)is_prime, SIZE, true);
  is_prime[0] = is_prime[1] = false;
  for (int i = 2; i < SIZE; i++) {
    if (!is_prime[i]) continue;
    p.emplace_back(i);
    for (int j = 2 * i; j < SIZE; j += i) {
      is_prime[j] = false;
    }
  }

  while (cin >> n >> x, n) {
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i < n; i++) {
      cin >> v[i];
    }
    dp[0] = true;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j + v[i] <= x; j++) {
        if (dp[j]) dp[j + v[i]] = true;
      }
    }
    int ans = 0;
    for (int i : p) {
      if (i > x) break;
      if (dp[i]) ans = i;
    }
    if (ans == 0) cout << "NA" << endl;
    else cout << ans << endl;
  }

  return 0;
}
