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


#define M 100009
#define endl "\n"
#define pb push_back
#define ll long long int
#define mod9 1000000009
#define FIO std::ios_base::sync_with_stdio(false);cin.tie(NULL);
#define clear_buffer  cin.ignore(numeric_limits<streamsize>::max(),'\n');
#define pii pair < int , int >
#define ppi pair < pii, int >
#define ff first
#define ss second


int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    FIO;
    ll n, q;
    cin >> n >> q;
    int pos[50 + 1] = {0};
    for(ll i = 0; i < n; i++)
    {
        ll x;
        cin >> x;
        if(pos[x] == 0) pos[x] = i + 1;
    }

    for(ll i = 0; i < q; i++)
    {
        
        int y;
        cin >> y;
        cout << pos[y] << " ";
        for(int j = 0 ; j <= 50; j++)
        {
            if(pos[j] < pos[y]) pos[j]++; 
        }
        pos[y] = 1;
        
    }

    return 0;
}