n,k = map(int,input().strip().split()) c = map(int,input().strip().split()) if k >= n: print(min(c))