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

struct BIT{
	int n;
	vector<int>tree;

	BIT(int _n){
		n=_n+5;
		tree.resize(n,0);
	}

	void update(int index,int val){
		index+=1;
		while(index<n){
			tree[index]+=val;
			index+=(index&(-index));
		}
	}
	int query(int index){
		index+=1;
		int sum=0;
		while(index>0){
			sum+=tree[index];
			index-=(index&(-index));
		}
		return sum;
	}
	int query(int l,int r){
		return query(r)-query(l-1);
	}
};

void solve(){
	int n, q;cin>>n>>q;
	int a[n];
	int first[60];
	fill(first, first + 60, -1);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}

	BIT node(n);
	while(q--){
		int clr;cin>>clr;
		int i;
		for(i=0;i<n;i++)
			if(a[i] == clr)	break;
		cout<<i+1<<" ";
		for(int j=i-1;j>=0;j--)
			swap(a[j], a[j+1]);
	}
}

signed main(){
   	solve();
    return 0;
}
