#include <bits/stdc++.h>

#define FOR(i,x,n) 	for(int i=x; i<n; i++)
#define F0R(i,n) 	FOR(i,0,n)
#define ROF(i,x,n) 	for(int i=n-1; i>=x; i--)
#define R0F(i,n) 	ROF(i,0,n)

#define WTF 		cerr << "WTF" << endl
 
#define IOS 		ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define F 			first
#define S	 		second
#define pb 			push_back
#define mp 			make_pair

#define ALL(x) 		x.begin(), x.end()
#define RALL(x) 	x.rbegin(), x.rend()
#define FILL(a, b) 	memset(a, b, sizeof(a));

#define TOGGLE(x) (x) = 1 - (x)

using namespace std;
typedef double 			db;
typedef long long 		LL;
typedef string 			str;

typedef pair<int, int> 	PII;
typedef pair<LL, LL> 	PLL;

typedef vector<int> 	VI;
typedef vector<LL> 		VLL;
typedef vector<bool> 	VB;
typedef vector<char> 	VC;
typedef vector<PII> 	VPII;
typedef vector<string> 	VSTR;

typedef set<int> 		SI;
typedef set<PII> 		SPII;

typedef priority_queue<PII> DIPQ;

const int MAXN = 3e5 + 7;
const int MAXA = 1e7 + 7;
const int INF = 1e9;
const int MOD = 1e9 + 7;


int n, k, q, a;

void Solve () {
	VI color(51, INF);
	
	cin >> n >> k;
	
	F0R (i, n) {
		cin >> a;
		color[a] = min(i + 1, color[a]);
	}
	
	F0R (i, k) {
		cin >> q;
		cout << color[q] << ' ';
		F0R (i, 51) 
			if (color[i] < color[q]) color[i]++;
		
		color[q] = 1;
	}
	
	cout << endl;
}

int main() {
	IOS;
	Solve ();
}
