n,k=map(int,input().split()) c=[*map(int,input().split())] a=sorted([i for i in c if i>0]) if not a: print(max(c)) elif len(a)