#include <bits/stdc++.h>
#define vi vector<int>
#define ll long long
#define pb(A) push_back(A)
#define vll vector<ll>
 
using namespace std;

int main (){
 
 ios_base::sync_with_stdio(false); 
 cin.tie(NULL); cout.tie(NULL);
 
 vll v(51, -1);
 ll n, q;

    cin >> n >> q;
    for(ll i = 1; i <= n; i++){
        int tmp;
        cin >> tmp;
        if(v[tmp] == -1)
            v[tmp] = i;
    }
    while(q--){
        int tmp;
        cin >> tmp;
        cout << v[tmp] << ' ';
        for(int i = 1; i <= 50; i++)
            if(v[i] < v[tmp]) v[i]++;
        v[tmp] = 1;
    }
    cout << endl;

 return 0;
}