#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
#define MAX 1000000+1

bool prime[MAX+1];

void sieve(){
  prime[0] = prime[1] = false;
  for(int i=2;i<MAX;i++)
    prime[i] = true;
  for(int i=2;i<MAX;i++)
    if(prime[i])
      for(int j=i*2;j<MAX;j+=i)
	prime[j]=false;
}

bool isPrime(int n){
  return prime[n];
}

void solve(int n, int x, int *v){
  int dp[n+1][x+1];
  rep(i,x+1)
    dp[0][i]=0;

  for(int i=1;i<=n;i++)
    rep(j,x+1){
      int Not = dp[i-1][j];
      int Do  = dp[i-1][j-v[i-1]+1]+v[i-1];
      if(j<v[i])
	dp[i][j] = Not;
      else{
	if(isPrime(Do) && Do > Not)
	  dp[i][j]=Do;
	else
	  dp[i][j] = Not;
      }
    }

  /*
  putchar('\n');
  rep(i,n+1){
    printf("%d : ",i);
    rep(j,x+1){
      printf("%d ",dp[i][j]);
    }
    putchar('\n');
  }
  */

  if(dp[n][x])
    cout << dp[n][x] << endl;
  else
    cout << "NA" << endl;
}

int main(){
  sieve();
  int v[30];
  for(;;){
    int n,x;
    cin >> n >> x;
    if(!(n+x)) break;
    rep(i,n)
      cin >> v[i];
    solve(n,x,v);
  }
}