N,K,*as=$<.read.split.map(&:to_i)
m=10**9+7

if K == 1
  puts as[-1] - as[0]
  exit 0
end

as.sort!

min=max=0

i = N-K
j = 1
t = b = (1..K-1).inject(&:*)
while 0<=i
  min+=as[i]*t/b % m
  max+=as[j+K-2]*t/b % m
  t = t * (K-1+j) / j
  i-=1
  j+=1
end

ret = (max-min) % m

puts ret