#include<bits/stdc++.h>
#define N 1000001
using namespace std;
vector<int>a[N+1];
int main()
{
int i, j, n, m, x, y;
while(cin >> n >> m)
{
for(i=1; i<=N; i++)
a[i].clear();
int b[n];
for(i=0;i<n;i++)
{
cin >>b[i];
a[b[i]].push_back(i+1);
}
for(i=1;i<=m;i++)
{
cin >> x >> y;
if(a[y].size() < x)
cout << 0 << endl;
else
cout << a[y][x-1] << endl;
}
}
return 0;
}
#define N 1000001
using namespace std;
vector<int>a[N+1];
int main()
{
int i, j, n, m, x, y;
while(cin >> n >> m)
{
for(i=1; i<=N; i++)
a[i].clear();
int b[n];
for(i=0;i<n;i++)
{
cin >>b[i];
a[b[i]].push_back(i+1);
}
for(i=1;i<=m;i++)
{
cin >> x >> y;
if(a[y].size() < x)
cout << 0 << endl;
else
cout << a[y][x-1] << endl;
}
}
return 0;
}
Comments
Post a Comment