#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#define Debug(in) cout<<#in<<"="<<(in)<<endl
#define mm(a,x) memset(a,x,sizeof(a))
#define mkp(a,b) make_pair(a,b)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0)
#define endl '\n'
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f,mod=1e9+7;
const int N=3e5+10;
int n,m;
int a[N],p[55];
int main(void)
{
    sync;
    cin>>n>>m;
    for(int i=1;i<=n;++i)
    {
        cin>>a[i];
        if(!p[a[i]]) p[a[i]]=i;
    }
    while(m--)
    {
        int t;cin>>t;
        cout<<p[t]<<" ";
        for(int i=1;i<=50;++i)
        {
            if(i==t) continue;
            if(p[i]<p[t]) ++p[i];
        }
        p[t]=1;
    }
    return 0;
}
//考虑边界！！！
//Think TWICE, Code ONCE!