#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	//int t; cin >> t;
	//while(t--){
		int n, q; cin >> n >> q;
		vector<int> mps(51, 0);
		for(int i = 1;i <= n;i++){
			int a; cin >> a;
			if(!mps[a]) mps[a] = i;
		}
		for(int i = 0;i < q;i++){
			int qr; cin >> qr;
			cout << mps[qr] << ' ';
			for(int j = 1;j <= 50;j++){
				if(mps[j] < mps[qr]) mps[j]++;
			}mps[qr] = 1;
		}cout << '\n';
	//}
	return 0;
}
//const int MOD = 1e9 + 7;
//tod-ngen 
