capa=int(input()) n=int(input()) l = list(map(int,input().split())) l.sort() itr=0 sum=0 while(itr