# előzések
sor1 = list(map(int, input().split(' '))); N = sor1[0]; elozes = sor1[0]
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 | Wrong answer | 17ms | 3048 KiB | ||||
subtask2 | 0/30 | ||||||
2 | Runtime error | 17ms | 2960 KiB | ||||
3 | Runtime error | 17ms | 2980 KiB | ||||
4 | Runtime error | 17ms | 3088 KiB | ||||
5 | Runtime error | 17ms | 3172 KiB | ||||
6 | Runtime error | 17ms | 3172 KiB | ||||
7 | Runtime error | 17ms | 3300 KiB | ||||
subtask3 | 0/70 | ||||||
8 | Runtime error | 26ms | 6704 KiB | ||||
9 | Runtime error | 39ms | 10956 KiB | ||||
10 | Runtime error | 39ms | 12548 KiB | ||||
11 | Runtime error | 54ms | 18200 KiB | ||||
12 | Runtime error | 59ms | 18912 KiB | ||||
13 | Runtime error | 59ms | 20432 KiB | ||||
14 | Runtime error | 68ms | 24660 KiB | ||||
15 | Runtime error | 78ms | 26120 KiB | ||||
16 | Runtime error | 79ms | 26276 KiB | ||||
17 | Runtime error | 72ms | 26232 KiB | ||||
18 | Runtime error | 75ms | 26400 KiB | ||||
19 | Runtime error | 79ms | 26156 KiB | ||||
20 | Runtime error | 70ms | 24684 KiB | ||||
21 | Runtime error | 78ms | 26380 KiB |