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

//#define int long long

void solution (deque <int> &q, int req){
    int i=1;
    for (auto it=q.begin(); it!=q.end(); it++){
        if (*it==req){
            q.erase(it);
            q.push_front(req);
            cout << i << " ";
            return;
        }
        i++;
    }
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int n, q;
    cin >> n >> q;
    deque <int> qu;
    for (int i = 0; i < n; i++){
        int temp;
        cin >> temp;
        qu.push_back(temp);
    }
    for (int i=0; i<q; i++){
        int temp;
        cin >> temp;
        solution (qu, temp);
    }
    return 0;
}