Hình 1:
[n,m] = input().split()
a = input().split()
b = [int(i) for i in a]
c = sorted(list(filter(lambda x: x < 0, b)))
print(-sum(c[0:int(m)]))
=============================
Hình 2:
[n,m] = input().split()
a = input().split()
c = sorted(list(filter(lambda x: x < 0, [int(i) for i in a])))
print(-sum(c[0:int(m)]))