import Control.Applicative
import Data.List
import Control.Monad

diffs (x:[]) = []
diffs (x:y:xs) = (y - x):(diffs (y:xs))

solve k [] = 1
solve 1 (x:xs) = x + solve 1 xs
solve k (x:xs) = 1 + solve (k - 1) xs

main = do
  [n, k] <- map read . words <$> getLine
  t <- map read <$> replicateM n getLine
  print $ solve k $ sortBy (flip compare) . diffs $ t

