acwing. 789.数的范围
//没有正经写二分[doge]
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N];
int main() {
int n, k;
cin >> n >> k;
for (int i = 0; i < n; i++)cin >> a[i];
while (k--) {
int b;
cin >> b;
if(lower_bound(a,a+n,b)-a+1>upper_bound(a,a+n,b)-a)cout<<"-1 -1"<<endl;
else{
cout << lower_bound(a, a + n, b) - a << " " << upper_bound(a, a + n, b) - a-1 << endl;
}
}
return 0;
}