#include <iostream>
#include <algorithm>
using namespace std;
int n, q;
long long a[1007], book[1007], len[1007], read[1007];
int main() {
cin >> n >> q;
for (int i = 1; i <= 1007; i++)
a[i] = 1;
for (int i = 1; i <= n; i++)
cin >> book[i];
sort (book, book + n + 1);
for (int i = 1; i <= q; i++) {
cin >> len[i] >> read[i];
for (int j = 1; j <= len[i]; j++)
a[i] *= 10;
}
for (int i = 1; i <= q; i++) {
for (int j = 1; j <= n; j++) {
if (book[j] % a[i] == read[i]) {
cout << book[j] << endl;
break;
} else if (j == n) {
cout << "-1" << endl;
break;
}
}
}
return 0;
}
显示Wrong Answer.wrong answer Too short on line 1.,改了好多次了,求调QwQ。