[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main _ =
    let [n;_] = reads int
    let xs = reads int
    let bs =
        List.sort xs
        |> List.pairwise
        |> List.map (fun (x, y) -> y - x)
        |> List.sortDescending
    List.skip (min (n - 1) (List.length bs)) bs
    |> List.sum
    |> printfn "%i"
    0