M=10**9+7
def extended_gcd(a, b)
  last_remainder, remainder = a.abs, b.abs
  x, last_x, y, last_y = 0, 1, 1, 0
  while remainder != 0
    last_remainder, (quotient, remainder) = remainder, last_remainder.divmod(remainder)
    x, last_x = last_x - quotient*x, x
    y, last_y = last_y - quotient*y, y
  end
  return last_remainder, last_x * (a < 0 ? -1 : 1)
end

def invmod(e)
  g, x = extended_gcd(e, M)
  x % M
end

n,k,*as=$<.read.split.map &:to_i
as.sort!

cvs=[0]*(k-1)
t=1
(n-k+1).times{|i|
  cvs.push(t)
  t=t*(i+k)*invmod(i+1)%M
}
puts (0...n).reduce(0){|s,i|
  (s+(cvs[i]-cvs[n-i-1])*as[i])%M
}
