n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
h = Hash.new(0)
a.combination(k).each do |x|
  h[x.max - x.min] += 1
end
ans = 0
h.each do |k, v|
  ans += k * v
  ans %= 1_000_000_007
end
puts ans