#include <bits/stdc++.h>

using namespace std;

#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

typedef long long ll;
typedef pair<int, int> pii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n, q;
    cin >> n >> q;
    vector<int> up(55, 0);
    for (int i = 1; i <= n; ++i) {
        int x;
        cin >> x;
        if (up[x] == 0) up[x] = i;
    }
    while(q--) {
        int x;
        cin >> x;
        cout << up[x] << ' ';
        for (int y = 0; y < 55; ++y) {
            if (up[y] < up[x]) ++up[y];
        }
        up[x] = 1;
    }
}