include <bits/stdc++.h>
using namespace std; using ll=long long; int main() { int n,q; cin>>n>>q; pair<int,int>a[n+1]; for(int i=1;i<=n;i++) { cin>>a[i].first; a[i].second=i; } sort(a+1,a+1+n); while(q--) { int t; cin>>t; if(t==1) cout<<a[1].second; else cout<<a[n].second; cout<<'\n'; } }