# 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 range(elozes):
ki = C.index(f[i]); kit = C[ki-1]
#print(C, f[i], kit, n.index(m)+1)
C[ki-1], C[ki] = C[ki], C[ki-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 | 3048 KiB | ||||
3 | Runtime error | 17ms | 3044 KiB | ||||
4 | Runtime error | 18ms | 3088 KiB | ||||
5 | Runtime error | 18ms | 3244 KiB | ||||
6 | Runtime error | 17ms | 3216 KiB | ||||
7 | Runtime error | 17ms | 3120 KiB | ||||
subtask3 | 0/70 | ||||||
8 | Runtime error | 28ms | 6608 KiB | ||||
9 | Runtime error | 37ms | 10956 KiB | ||||
10 | Runtime error | 41ms | 12596 KiB | ||||
11 | Runtime error | 54ms | 17820 KiB | ||||
12 | Runtime error | 57ms | 18936 KiB | ||||
13 | Runtime error | 59ms | 20312 KiB | ||||
14 | Runtime error | 75ms | 24660 KiB | ||||
15 | Runtime error | 74ms | 26360 KiB | ||||
16 | Runtime error | 74ms | 26228 KiB | ||||
17 | Runtime error | 79ms | 26248 KiB | ||||
18 | Runtime error | 72ms | 26228 KiB | ||||
19 | Runtime error | 74ms | 26376 KiB | ||||
20 | Runtime error | 70ms | 24652 KiB | ||||
21 | Runtime error | 78ms | 26380 KiB |