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) if l == 0: echo max a else: echo sum b[0..