class Combinatorics
  def initialize(n, mod)
    @mod = mod
    @fact, @inv, @finv = Array.new(3){[1, 1]}
    2.upto(n) do |i|
      @fact[i] = (@fact[i-1] * i) % @mod
      @inv[i]  = (@inv[@mod % i] * (@mod - @mod / i) ) % @mod
      @finv[i] = (@finv[i-1] * @inv[i] ) % @mod
    end
  end
  def combination(n, r)
    return 0 if (n < r) || (n < 0) || (r < 0)
    (@fact[n] * @finv[n-r] % @mod) * @finv[r] % @mod
  end
  def permutation(n, r)
    return @fact[n] * @finv[n-r] % @mod
  end
end

M=10**9+7
N,K=gets.split.map(&:to_i)
A=gets.split.map(&:to_i).sort
C=Combinatorics.new(N+K+1, M)

ans=0
A.reverse.each.with_index do |a,i|
  ans+=a*C.combination(N-1-i, K-1)%M
  ans%=M
end
A.each.with_index do |a,i|
  ans+=M-a*C.combination(N-1-i, K-1)%M
  ans%=M
end
p ans