#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define vt vector
#define ar array


void solve(){
    ll res;
    int n, q;

    cin >> n >> q;
    vt <int> a(n);
    vt <int> t(q);

    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    for (int i = 0; i < q; i++){
        cin >> t[i];
    }


    for (int i = 0; i < q; i++){
        for (int j = 0; j < n; j++){
            if (a[j] == t[i]){
                cout << j + 1 << " ";
                rotate(a.begin(), a.begin() + j, a.begin() + j + 1);
                break;

            }
        }
    }

}



int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int test_cases = 1;
//    cin >> test_cases;
    while (test_cases--){
        solve();
        cout << '\n';
    }
    return 0;
}
