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

#define FOR(x,n) for(int x=0;x<n;x++)
#define mp make_pair
#define PI 3.14159265358979323846264338327950288
typedef long long ll;
typedef pair<int,int> ii;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n, q;
  cin >> n >> q;

  int arr[n];
  FOR(i,n) cin >> arr[i];

  FOR(i,q) {
    int t;
    cin >> t;
    int idx = -1;
    FOR(i,n) {
      if(arr[i] == t) {
	idx = i;
	break;
      }
    }

    cout << idx + 1 << ' ';
    for(int i = idx - 1; i >= 0; i--) {
      arr[i + 1] = arr[i];
    }
    arr[0] = t;
  }
  cout << '\n';
}

// UPDATE N WHEN UR DONE AAAAAAAAAAAAAAAAAAAAAAAAAAA (if it applies lol)
