#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int t,i,j,n,q;
   
        cin>>n>>q;
        long long int a[n+2],h[100] = {0},b[q+2];

        for(i=1;i<=n;i++)
        {
            cin>>a[i];
            if(h[a[i]]==0)
            h[a[i]] = i;
        }
        for(i=1;i<=q;i++)
        {
            cin>>b[i];
        }

        for(i=1;i<=q;i++)
        {
            cout<<h[b[i]]<<" ";

            for(j=1;j<=50;j++)
            {
                if(h[j]<h[b[i]])
                h[j] = h[j] + 1;
            }
            h[b[i]] = 1;
        } 
        cout<<endl;
    
}