n,k=map(int,input().split()) l=[int(i)for i in input().split()if int(i)>-1] l.sort(reverse=1>0) a=sum(l if len(l)