# előzések
sor1 = list(map(int, input().split(' '))); N = sor1[0]; elozes = sor1[1]
C = list(map(int, input().split(' ')))
f = []
for i in range(elozes):
f += [int(input())]
#f = list(map(int, '1 1 1 4 3 7 4 6'.split(' ')))
n = [0]*N
for i in f:
pos = C.index(i); kit = C[pos-1]
#print(kit, end=' ')
#print(C, f[i], kit, n.index(m)+1)
C[pos-1], C[pos] = C[pos], C[pos-1]
n[kit-1] += 1; m = max(n)
print(n.index(m)+1)
#print(C)
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 17ms | 3044 KiB | ||||
subtask2 | 0/30 | ||||||
2 | Runtime error | 17ms | 3044 KiB | ||||
3 | Runtime error | 17ms | 2980 KiB | ||||
4 | Runtime error | 17ms | 3172 KiB | ||||
5 | Runtime error | 17ms | 3120 KiB | ||||
6 | Runtime error | 18ms | 3176 KiB | ||||
7 | Runtime error | 17ms | 3320 KiB | ||||
subtask3 | 0/70 | ||||||
8 | Runtime error | 28ms | 6740 KiB | ||||
9 | Runtime error | 35ms | 11076 KiB | ||||
10 | Runtime error | 43ms | 12480 KiB | ||||
11 | Runtime error | 50ms | 17864 KiB | ||||
12 | Runtime error | 54ms | 19012 KiB | ||||
13 | Runtime error | 57ms | 20356 KiB | ||||
14 | Runtime error | 74ms | 24660 KiB | ||||
15 | Runtime error | 79ms | 26364 KiB | ||||
16 | Runtime error | 74ms | 26232 KiB | ||||
17 | Runtime error | 79ms | 26248 KiB | ||||
18 | Runtime error | 79ms | 26272 KiB | ||||
19 | Runtime error | 78ms | 26104 KiB | ||||
20 | Runtime error | 70ms | 24800 KiB | ||||
21 | Runtime error | 78ms | 26304 KiB |