import algorithm, math, sequtils, strutils let nk, a = stdin.readLine.split.map parseInt k = nk[1] b = a.filterIt(it > 0).sortedByIt -it l = min(k, b.len) echo sum b[0..