// Bismillahir Rahmanir Rahim
//============================
#include<bits/stdc++.h>
using namespace std;

#define ll          int
#define endl        "\n"
#define infL        LLONG_MAX
#define infI        INT_MAX
#define pb          push_back
#define fo(i,a,b)   for(int i=a;i<b;i++)
#define fo2(i,a,b)  for(int i=a;i<=b;i++)
#define rfo(i,a,b)  for(int i=a; i>=b;i--)
#define precise(x,y)cout<<fixed<<setprecision(y)<<x<<endl;
#define MAX         100010
#define yes         cout<<"YES"<<endl
#define no          cout<<"NO"<<endl
#define bye         return 0
#define debug       cout<<"\nDebug\n";
#define debug2      cout<<"\nDebug2\n";
#define PEREGRINE_FALCON {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

typedef pair<ll,ll>PII;
double epsilon = 0.0000001f;
ll mod=1e9+7;
double Pi =acos(-1);

void print(vector<ll>V)
{
      cout<<"\n---------------Vector checking start-------------------\n";
      ll sz=V.size();
      fo(i,0,sz){cout<<V[i]<<"  ";}
      cout<<"\n----------------Vector checking end--------------------\n";
}

void print(ll arr[], ll n)
{
      cout<<"\n---------------Array checking start-------------------\n";
      fo(i,0,n){cout<<arr[i]<<" ";}
      cout<<"\n----------------Array checking end--------------------\n";
}

struct strct{

};

int main()
{
      PEREGRINE_FALCON
      //freopen("inputNew.txt", "r", stdin);

      ll testCase=1;
      //cin>>testCase;
      while(testCase--){
            ll n,m,k,x,y,z,a,b,c,d,mn,mx,temp,cnt,ans,sum,sz,len;
            cin>>n>>k;
            ll arr[n];
            int mp[60]={0};
            fo(i,0,n){
                  cin>>arr[i];
                  if(mp[arr[i]]) continue;
                  mp[arr[i]]=i+1;
            }

            while(k--){
                  cin>>a;
                  x=mp[a];
                  cout<<x<<" ";

                  fo2(i,1,50){
                        if(mp[i] && mp[i]<x){
                              mp[i]++;
                        }
                  }
                  mp[a]=1;
            }
            cout<<endl;
      }

      bye;
}

