lower_bound
[https://vjudge.net/contest/220173#problem/A]
#include<bits/stdc++.h>
using namespace std;
#define maxn 1010
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n,p,x;
int a[maxn];
int kase=0;
while(cin>>n>>p&&n){
printf("CASE# %d:\n",++kase);
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
while(p--){
cin>>x;
int q=lower_bound(a,a+n,x)-a;
if(a[q]==x) printf("%d found at %d\n",x,q+1);
else printf("%d not found\n",x);
}
}
return 0;
}