#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];

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

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

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

  int max=0;
  for(int i=1;i<n+1;i++)
    for(int j=1;j<x+1;j++){
      int Do =  dp[i][j-v[i]]+v[i];
      int Not = dp[i-1][j];
      if(j<v[i-1])
	dp[i][j] = Not;
      else{
	if (Do > Not){
	  dp[i][j] = Do;
	  if(max<Do && isPrime(Do) && Do<=x)
	    max=Do;
	}
	else
	  dp[i][j] = Not;
      }
    }
  /*
  putchar('\n');
  rep(i,n+1){
    printf("%d :",i+1);
    rep(j,x){
      printf("%2d ",dp[i][j]);
    }
    putchar('\n');
  }
  */
   if(max)
    cout << max << endl;
  else
    cout << "NA" << endl;
}

int main(){
  sieve();
  int v[31];
  v[0]=0;
  for(;;){
    int n,x;
    cin >> n >> x;
    if(!(n+x)) break;
    for(int i=1;i<n+1;i++)
      cin >> v[i];
    solve(n,x,v);
  }
}