module main;
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

const int MX = 1000000;

int N, X;
int[MX] is_prime, dp;
int[30] p;
void main()
{
  bool[MX] done;
  is_prime[1] = true;
  for(auto i = 2; i < MX; i++)
  {
    if(done[i])
      continue;
    is_prime[i] = true;
    for(auto j = i; j < MX; j += i)
      done[j] = true;
  }
  while(true)
  {
    readf("%d %d\n", &N, &X);
    if(!N)
      break;
    X++;
    
    for(auto i = 0; i < X; i++)
      dp[i] = 0;

    int ans;
    for(auto i = 0; i < N; i++)
      readf("%d\n", &p[i]);
    for(auto i = 0; i < N; i++)
    {
      for(auto j = p[i]; j < X; j++)
      {
        dp[j] = max(dp[j], dp[j - p[i]] + p[i]);
        if(is_prime[dp[j]])
          ans = max(ans, dp[j]);
      }
    }
    writeln(ans == 0 ? "NA" : to!string(ans));
  }
}