Language: C++

#include<bits/stdc++.h>
using namespace std;
bool sosu[1000005]={0};
bool check[1000005];
main(){
????int n,k;
????int shop;
????sosu[1]=1;
????for(int i=2;i<(int)sqrt(1000005);i++){
????????if(sosu[i]==0){
????????????for(int j=i;j<1000005;j+=i){
????????sosu[j]=true;
????????????}
????????}
????}
????while(1){
????????bool a=true;
????????cin>>n>>k;
????????if(n==0&&k==0)break;
????????memset(check,false,sizeof(check));
????????for(int i=1;i<=n;i++){
????????????scanf("%d",&shop);
????????????check[shop]=true;
????????????for(int j=shop;j<=k;j++){
????????if(check[j-shop]==true){
????????????check[j]=true;
????????}
????????????}?? 
????????}
????????for(int i=k;i>0;i--){
????????????if(sosu[i]==false&&check[i]==true){
????????cout<<i<<endl;
????????i=0;
????????a=false;
????????????} 
????????}
????????if(a){
????????????cout<<"NA"<<endl;
????????}
????}
}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:6:1: error: expected primary-expression before '?' token
    6 | ????int n,k;
      | ^
a.cc:6:2: error: expected primary-expression before '?' token
    6 | ????int n,k;
      |  ^
a.cc:6:3: error: expected primary-expression before '?' token
    6 | ????int n,k;
      |   ^
a.cc:6:4: error: expected primary-expression before '?' token
    6 | ????int n,k;
      |    ^
a.cc:6:5: error: expected primary-expression before 'int'
    6 | ????int n,k;
      |     ^~~
a.cc:6:5: error: expected ':' before 'int'
    6 | ????int n,k;
      |     ^~~
      |     :
a.cc:6:5: error: expected primary-expression before 'int'
    6 | ????int n,k;
      |     ^~~
a.cc:6:5: error: expected ':' before 'int'
    6 | ????int n,k;
      |     ^~~
      |     :
a.cc:6:5: error: expected primary-expression before 'int'
    6 | ????int n,k;
      |     ^~~
a.cc:6:5: error: expected ':' before 'int'
    6 | ????int n,k;
      |     ^~~
      |     :
a.cc:6:5: error: expected primary-expression before 'int'
    6 | ????int n,k;
      |     ^~~
a.cc:6:5: error: expected ':' before 'int'
    6 | ????int n,k;
      |     ^~~
      |     :
a.cc:6:5: error: expected primary-expression before 'int'
    6 | ????int n,k;
      |     ^~~
a.cc:7:1: error: expected primary-expression before '?' token
    7 | ????int shop;
      | ^
a.cc:7:2: error: expected primary-expression before '?' token
    7 | ????int shop;
      |  ^
a.cc:7:3: error: expected primary-expression before '?' token
    7 | ????int shop;
      |   ^
a.cc:7:4: error: expected primary-expression before '?' token
    7 | ????int shop;
      |    ^
a.cc:7:5: error: expected primary-expression before 'int'
    7 | ????int shop;
      |     ^~~
a.cc:7:5: error: expected ':' before 'int'
    7 | ????int shop;
      |     ^~~
      |     :
a.cc:7:5: error: expected primary-expression before 'int'
    7 | ????int shop;
      |     ^~~
a.cc:7:5: error: expected ':' before 'int'
    7 | ????int shop;
      |     ^~~
      |     :
a.cc:7:5: error: expected primary-expression before 'int'
    7 | ????int shop;
      |     ^~~
a.cc:7:5: error: expected ':' before 'int'
    7 | ????int shop;
      |     ^~~
      |     :
a.cc:7:5: error: expected primary-expression before 'int'
    7 | ????int shop;
      |     ^~~
a.cc:7:5: error: expected ':' before 'int'
    7 | ????int shop;
      |     ^~~
      |     :
a.cc:7:5: error: expected primary-expression before 'int'
    7 | ????int shop;
      |     ^~~
a.cc:8:1: error: expected primary-expression before '?' token
    8 | ????sosu[1]=1;
      | ^
a.cc:8:2: error: expected primary-expression before '?' token
    8 | ????sosu[1]=1;
      |  ^
a.cc:8:3: error: expected primary-expression before '?' token
    8 | ????sosu[1]=1;
      |   ^
a.cc:8:4: error: expected primary-expression before '?' token
    8 | ????sosu[1]=1;
      |    ^
a.cc:8:14: error: expected ':' before ';' token
    8 | ????sosu[1]=1;
      |              ^
      |              :
a.cc:8:14: error: expected primary-expression before ';' token
a.cc:8:14: error: expected ':' before ';' token
    8 | ????sosu[1]=1;
      |              ^
      |              :
a.cc:8:14: error: expected primary-expression before ';' token
a.cc:8:14: error: expected ':' before ';' token
    8 | ????sosu[1]=1;
      |              ^
      |              :
a.cc:8:14: error: expected primary-expression before ';' token
a.cc:8:14: error: expected ':' before ';' token
    8 | ????sosu[1]=1;
      |              ^
      |              :
a.cc:8:14: error: expected primary-expression before ';' token
a.cc:9:1: error: expected primary-expression before '?' token
    9 | ????for(int i=2;i<(int)sqrt(1000005);i++){
      | ^
a.cc:9:2: error: expected primary-expression before '?' token
    9 | ????for(int i=2;i<(int)sqrt(1000005);i++){
      |  ^
a.cc:9:3: error: expected primary-expression before '?' token
    9 | ????for(int i=2;i<(int)sqrt(1000005);i++){
      |   ^
a.cc:9:4: error: expected primary-expression before '?' token
    9 | ????for(int i=2;i<(int)sqrt(1000005);i++){
      |    ^
a.cc:9:5: error: expected primary-expression before 'for'
    9 | ????for(int i=2;i<(int)sqrt(1000005);i++){
      |     ^~~
a.cc:9:5: error: expected ':' before 'for'
    9 | ????for(int i=2;i<(int)sqrt(1000005);i++){
      |     ^~~
      |     :
a.cc:9:5: error: expected primary-expression before 'for'
    9 | ????for(int i=2;i<(int)sqrt(1000005);i++){
      |     ^~~
a.cc:9:5: error: expected ':' before 'for'
    9 | ????for(int i=2;i<(int)sqrt(1000005);i++){
      |     ^~~
      |     :
a.cc:9:5: error: expected primary-expression before 'for'
    9 | ????for(int i=2;i<(int)sqrt(1000005);i++){
      |     ^~~
a.cc:9:5: error: expected ':' before 'for'
    9 | ????for(int i=2;i<(int)sqrt(1000005);i++){
      |     ^~~
      |     :
a.cc:9:5: error: expected primary-expression before 'for'
    9 | ????for(int i=2;i<(int)sqrt(1000005);i++){
      |     ^~~
a.cc:9:5: error: expected ':' before 'for'
    9 | ????for(int i=2;i<(int)sqrt(1000005);i++){
      |     ^~~
      |     :
a.cc:9:5: error: expected primary-expression before 'for'
    9 | ????for(int i=2;i<(int)sqrt(1000005);i++){
      |     ^~~
a.cc:9:17: error: 'i' was not declared in this scope
    9 | ????for(int i=2;i<(int)sqrt(1000005);i++){
      |                 ^
a.cc:16:1: error: expected primary-expression before '?' token
   16 | ????while(1){
      | ^
a.cc:16:2: error: expected primary-expression before '?' token
   16 | ????while(1){
      |  ^
a.cc:16:3: error: expected primary-expression before '?' token
   16 | ????while(1){
      |   ^
a.cc:16:4: error: expected primary-expression before '?' token
   16 | ????while(1){
      |    ^
a.cc:16:5: error: expected primary-expression before 'while'
   16 | ????while(1){
      |     ^~~~~
a.cc:16:5: error: expected ':' before 'while'
   16 | ????while(1){
      |     ^~~~~
      |     :
a.cc:16:5: error: expected primary-expression before 'while'
   16 | ????while(1){
      |     ^~~~~
a.cc:16:5: error: expected ':' before 'while'
   16 | ????while(1){
      |     ^~~~~
      |     :
a.cc:16:5: error: expected primary-expression before 'while'
   16 | ????while(1){
      |     ^~~~~
a.cc:16:5: error: expected ':' before 'while'
   16 | ????while(1){
      |     ^~~~~
      |     :
a.cc:16:5: error: expected primary-expression before 'while'
   16 | ????while(1){
      |     ^~~~~
a.cc:16:5: error: expected ':' before 'while'
   16 | ????while(1){
      |     ^~~~~
      |     :
a.cc:16:5: error: expected primary-expression before 'while'
   16 | ????while(1){
      |     ^~~~~