#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn];
int main() {
    int n, m;
    cin >> n >> m;
    int id[55];
    for (int i = 1; i <= 55; i++) {
        id[i] = -1;
    }
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        if (id[x] == -1) {
            id[x] = i;
        }
    }

    for (int i = 1; i <= m; i++) {
        int y;
        cin >> y;
        cout << id[y] << " ";
        for (int i = 1; i <= 50; i++) {
            if (id[i] < id[y]) {
                id[i]++;
            }
        }
        id[y] = 1;
    }
    return 0;
}