n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i).sort
M = 10 ** 9 + 7

def power(x, n)
    return 1 if n == 0
    (n.odd? ? x : 1) * power(x ** 2 % M, n / 2) % M
end

com = Array.new(n, 0)
com[k-1] = 1
k.upto(n-1) {|i| com[i] = com[i-1] * i * power(i-k+1, M-2) % M}
p com

ans = 0
0.upto(n-k) {|i| ans -= a[i] * com[n-i-1]}
(k-1).upto(n-1) {|i| ans += a[i] * com[i]}
p ans % M