#include using namespace std; using ll = long long int; using iPair = pair; using lPair = pair; using ivector = vector; using lvector = vector; using istack = stack; using iqueue = queue; using ivv = vector>; using lvv = vector>; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3f; vector dir = {{1,0}, {-1,0}, {0,1}, {0,-1}}; #define dump(x) cout << #x << " = " << (x) << endl #define ALL(x) begin(x),end(x) #define rep(i,s,e) for(ll i=(s), i_stop=(e); i=i_stop; --i) #define range(i,s,n) for(ll i=(s), i_stop=(s)+(n); ii_stop; --i) #define foreach(x,container) for(auto &&x:container) template bool chmax(T& a, const T b) {if(a bool chmin(T& a, const T b) {if(a>b) {a=b;return true;} return false;} template void printArr(vector &arr){ for(auto &x:arr) {cout << x << " ";} cout << endl; } /* 因爲涉及到餘數,寫代碼從0開始。 */ struct NumberTheory{ inline ll mod(ll a, ll m){ return (a % m + m) % m; } // 參數引用形式返回 ap + bq = gcd(a,b) 的一組解(p0, q0) // 返回值形式返回 gcd(a,b) ll extGcd(ll a, ll b, ll &p, ll &q){ if( b == 0 ) { p = 1; q = 0; return a; } ll d = extGcd(b, a%b, q, p); q = q - (a/b) * p; return d; } // 當a與m互素時,返回乘法逆元。否則返回-1 ll modinv(ll a, ll m) { ll p, q; ll d = extGcd(a,m,p,q); return (d==1)?mod(p,m):-1; } // 返回中國剩餘定理的解以及最小公倍數 pair crt(vector b, vector m){ ll r = 0, M = 1; for(int i = 0; i < (int)b.size(); ++i){ ll p, q; ll d = extGcd(M, m[i], p, q); if((b[i] - r) % d != 0) return make_pair(0, -1); ll tmp = (b[i] - r) / d * p % (m[i] / d); r += M * tmp; M *= m[i] / d; } return make_pair(mod(r, M), M); } }; void solve() { int n,m; cin>>n>>m; map mapping; vector res; ivector a(n); range(i, 0, n) {cin>>a[i]; mapping[a[i]] = i;} ivector b(m); range(i, 0, m) { cin>>b[i]; if(mapping.count(b[i])) { res.emplace_back(mapping[b[i]], i); } } if(res.size() == 0) { cout<<-1<