from collections import deque n,k = map(int,input().split()) a = list(map(int,input().split())) dq = deque([n-1]) for i in range(n-2,-1,-1): if a[i]