let k_n = stdin.ReadLine().Split(' ') |> Array.map int
let mutable a = stdin.ReadLine().Split(' ') |> Array.map int
a <- Array.sort(a)
a <- Array.rev(a)
let mutable ans = 0
for i in [0..k_n.[1]-1]do
ans<-ans+a.[i]
done;;
printfn "%d" ans
