import streams, sequtils, strutils, algorithm, math, future, sets, tables, hashes proc `ceilDiv`*[T](x, y: T): T = x div y + ord(x mod y != 0) proc `//=`*(x: var SomeInteger; y: SomeInteger) = x = x div y proc `%=`*(x: var SomeInteger; y: SomeInteger) = x = x mod y var L = stdin.readLine.split.map(parseInt) N = L[0] K = L[1] A = stdin.readLine.split.map(parseInt) ans = 0 cnt = 0 A = A.sortedByIt(-it) for i in 0.. 0: ans += A[i] inc cnt if cnt == 0: ans += A[0] echo ans