# előzések
sor1 = list(map(int, input().split(' '))); N = sor1[0]; elozes = sor1[0]
C = list(map(int, '5 2 3 4 1 7 6'.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 | Runtime error | 17ms | 3044 KiB | ||||
subtask2 | 0/30 | ||||||
2 | Runtime error | 18ms | 3224 KiB | ||||
3 | Runtime error | 17ms | 2952 KiB | ||||
4 | Runtime error | 17ms | 3096 KiB | ||||
5 | Runtime error | 17ms | 3044 KiB | ||||
6 | Runtime error | 17ms | 3044 KiB | ||||
7 | Runtime error | 17ms | 3192 KiB | ||||
subtask3 | 0/70 | ||||||
8 | Runtime error | 19ms | 3424 KiB | ||||
9 | Runtime error | 21ms | 4196 KiB | ||||
10 | Runtime error | 20ms | 3976 KiB | ||||
11 | Runtime error | 24ms | 4600 KiB | ||||
12 | Runtime error | 26ms | 5348 KiB | ||||
13 | Runtime error | 26ms | 4836 KiB | ||||
14 | Runtime error | 27ms | 5188 KiB | ||||
15 | Runtime error | 28ms | 5492 KiB | ||||
16 | Runtime error | 29ms | 5536 KiB | ||||
17 | Runtime error | 29ms | 5428 KiB | ||||
18 | Runtime error | 28ms | 5444 KiB | ||||
19 | Runtime error | 28ms | 5440 KiB | ||||
20 | Runtime error | 28ms | 5348 KiB | ||||
21 | Runtime error | 27ms | 5516 KiB |