int main(){ vector<int> tab; long long int curr; int tests,k,how=0,yes=0; cin>>tests>>k; for(int i=0;i!=tests;++i){cin>>curr; tab.push_back(curr);} bool KONIEC=0; do { how++; curr=k*how; yes=0; for(int i=0;i<tab.size();++i){if(tab[i]==curr){yes=1;}} if(yes==0){ cout<<curr; KONIEC=1; } } while (KONIEC==0);
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
vector<int> tab;
long long int curr;
int tests,k,how=0,yes=0;
cin>>tests>>k;
for(int i=0;i!=tests;++i){cin>>curr; tab.push_back(curr);}
bool KONIEC=0;
do
{
how++;
curr=k*how;
yes=0;
for(int i=0;i<tab.size();++i){if(tab[i]==curr){yes=1;}}
if(yes==0){
cout<<curr;
KONIEC=1;
}
}
while (KONIEC==0);
}