function main() {
  var
  n, m,
  i = 0, j, ans, dp, dp_, x, k, line, xs;
  for(;;) {
    line = input[i++].split(' ').map(parseFloat);
    n = line[0]; m = line[1];
    if (n === 0 && m === 0) break;
    
    xs = [];
    for (j = 0; j < n; j++) {
      xs.push(parseInt(input[i++], 10));
    }
    
    xs.sort(function (x, y) {
      return x - y;
    });
    
    dp = {};
    dp[0] = true;
    for (j = 0; j < n; j++) {
      for (k = 1; k <= m; k++) {
        dp[k] = dp[k] || dp[k - xs[j]] || false;
      }
    }
    
    ans = 0;
    for (j = 0; ps[j] <= m; j++) {
      if (dp[ps[j]]) {
        ans = Math.max(ans, ps[j]);
      }
    }

    console.log(ans || 'NA');
  }
}

function prims(n){
  var
  i, j, flag,
  prims = [2];
  if(n < 2) return [];
  for(i = 3;i <= n; i += 2) {
    flag = true;
    for(j = 0; prims[j] * prims[j] <= i; j++) {
      if(i % prims[j] == 0) {
        flag = false;
        break;
      }
    }
    if(flag) {
      prims.push(i);
    }
  }
  return prims;
}

var
ps = prims(1000000);

var
input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main();
});