```cpp
#include<bits/stdc++.h>
using namespace std;
int n,m,a[1000010];
map<int,int> qwq;
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>a[i];
if(!qwq[a[i]]){
qwq[a[i]]=i;
}
}
for(int i=1;i<=m;i++){
int b;
cin>>b;
if(!qwq[b]) cout<<-1<<" ";
else cout<<qwq[b]<<" ";
}
return 0;
}
```
by xiechengxuan1061862 @ 2024-03-16 16:09:04
感觉没有必要写那么复杂……
by xiechengxuan1061862 @ 2024-03-16 16:09:24
[ThisIsSirius_859](https://www.luogu.com.cn/user/1029903)
by xiechengxuan1061862 @ 2024-03-16 16:11:12