(N, K), As = readlines.map{|l| l.split.map(&:to_i)}
M = 10**9 + 7

as = [nil] + As.sort
fac, inv, fiv = [1, 1], [1, 1], [1, 1]
(2 .. N).each do |i|
  fac[i] = fac[i - 1]*i % M
  inv[i] = M - inv[M % i]*(M/i) % M
  fiv[i] = fiv[i - 1]*inv[i] % M
end
bnm = ->(n, k){fac[n] * fiv[n - k] * fiv[k] % M}
puts (1 .. N - K + 1).inject(0){|s, i| (s + bnm[N - i, K - 1]*(as[N - i + 1] - as[i])) % M}