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!

i = N-K
j = 1
t = b = 1
ret = 0
while 0<=i
  ret-=(as[i]*t/b)
  ret+=as[j+K-2]*t/b
  ret %= m
  t = t * (K-1+j) / j
  i-=1
  j+=1
end

puts re