mod=1000000007
def mi(a,m)
  b,u,v=m,1,0
  while b>0
    t=a/b
    a-=t*b
    u-=t*v
    a,b,u,v=b,a,v,u
  end
  u%=m
  u+=m if u<0
  return u
end
n,k=gets.split.map(&:to_i)
x=gets.split.map(&:to_i).sort
l=[]
(n-1).times do |i|
  l << x[i+1]-x[i]
end
s=l.sum
if k==1
  puts 0
  exit
end
a=0
b=0
bb=s
c=1
(n-1).times do |i|
  if i==0
    b=bb
  elsif i<n/2
    bb-=(l[i-1]+l[-i])
    b+=bb
  elsif i==n/2
    if n.odd?
#      bb+=(l[i]+l[-i-1])
    else
      b-=bb
      bb+=(l[i]+l[-i-1])
    end
  elsif i==n-2
    b=s
  else
    b-=bb
    bb+=(l[i]+l[-i-1])
  end
  if k==2
    a=(a+b)%mod
  else
    if i==k-2
      a=b%mod
    elsif i>k-2
      c=c*i%mod*mi(i-(k-2),mod)
      a=(a+b*(c%mod))%mod
    end
  end
end
puts a
