l=input() n=input() w=sorted(map(int,raw_input().split())) s = 0; i = 0 while i