import qualified Data.Vector as V
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

moduloN :: Int
moduloN = 10 ^ 9 + 7

modN = flip mod moduloN

finv :: Int -> Int
finv i = finvs V.! i
    where
        finv' 0 = 1
        finv' n = modN $ finvs V.! (n - 1) * inv n
        finvs :: V.Vector Int
        finvs = V.generate (10 ^ 5 + 1) finv'

inv :: Int -> Int
inv i = invs V.! i
    where inv' 1 = 1
          inv' n = modN (-(invs V.! r) * q)
              where (q, r) = moduloN `divMod` n
          invs :: V.Vector Int
          invs = V.generate (10 ^ 5 + 1) inv'

fact :: Int -> Int
fact i = facts V.! i
    where fact' 0 = 1
          fact' n = modN $ n * (facts V.! (n - 1))
          facts :: V.Vector Int
          facts = V.generate (10 ^ 5 + 1) fact'

c :: Int -> Int -> Int
c n k | n < 0 || k < 0 || n < k = 0
      | otherwise = modN $ modN (fact n * finv k) * finv (n - k)


main = do
    [n, k] <- getIntList
    as' <- getIntList
    let as = sort as'
    let minX = modN . sum . zipWith (\x y -> modN (x * y)) as $ map (\i -> c (n - i) (k - 1)) [1..n]
    let maxX = modN . sum . zipWith (\x y -> modN (x * y)) as $ map (\i -> c (i - 1) (k - 1)) [1..n]
    print . modN $ maxX - minX