m=int(input()) n=int(input()) w=list(map(int,input().split())) w.sort() count=0 sum=0 for i in range(n): sum+=w[i] count+=1 if m