Module Main
    Sub Main(args As String())
        Dim nk As String() = Split(Console.ReadLine, " ")
        Dim lss As String() = Split(Console.ReadLine, " ")
        Dim ls As List(Of Integer) = New List(Of Integer)
        Dim n As Integer = Integer.Parse(nk(0))
        Dim k As Integer = Integer.Parse(nk(1))
        Dim ans As Integer = 0
        For index = 0 To n - 1
            ls.Add(Integer.Parse(lss(index)))
        Next
        ls.Sort()
        ls.Reverse()
        For index = 0 To k - 1
            ans += ls(index)
        Next
        Console.WriteLine(ans.ToString)
    End Sub
End Module