n,k=map(int,input().split()) a=list(map(int,input().split())) a.sort() import bisect b=bisect.bisect_right(a,0) print(sum(a[b:]))