👤

rezolvare pozitie sir pbinfo


Răspuns :

#include <iostream>

using namespace std;

int n,x,u,k;

bool ok;

int main() {

 cin>>n>>x;

 for(int i=1;i<=n;i++) {

   cin>>u;

   if(!ok && u==x) ok=1;

   if(u<x) k++;

 }

 if(ok) cout<<n-k;

 else cout<<-1;

}