L=raw_input() N=raw_input() w=raw_input() W=map(int, w.split()) c=0 mx=0 W.sort() for a in W: c+=a print c if c