output_description: Print the answer \bmod (10^9+7).
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N K
      A_1 ... A_N
attempt: N, K = map(int, input().split())
  A = list(map(int, input().split()))
  mod = int(1e9 + 7)
  p = mod - 2
  ax = []
  while p != 0:
      ax = [p % 2] + ax[:]
      p //= 2
  A.sort()
  S = 0
  fact = 1
  invK = 1
  for i in range(K - 1):
      fact *= i + 1
      fact %= mod
  for j in range(len(ax)):
      if ax[j] == 1:
          invK *= fact
          invK %= mod
      if j != len(ax) - 1:
          invK *= invK
          invK %= mod
  invf = 1
  for k in range(K, N + 1):
      S += ((A[k - 1] - A[N - k]) * (fact * invf)) % mod
      S %= mod
      fact *= k
      fact %= mod
      lead = 1
      for j in range(len(ax)):
          if ax[j] == 1:
              lead *= k + 1 - K
              lead %= mod
          if j != len(ax) - 1:
              lead *= lead
              lead %= mod
      invf *= lead
      invf %= mod
  print((S * invK) % mod)
  
problem_description: Statement
  
  For a finite set of integers X, let f(X)=\max X - \min X.
  
  Given are N integers A_1,...,A_N.
  
  We will choose K of them and let S be the set of the integers chosen. If we
  distinguish elements with different indices even when their values are the
  same, there are {}_N C_K ways to make this choice. Find the sum of f(S) over
  all those ways.
  
  Since the answer can be enormous, print it \bmod (10^9+7).
samples: [{"input": "4 2\n    1 1 3 4", "output": "11\n    \n\nThere are six ways to choose S:\n\\\\{1,1\\\\},\\\\{1,3\\\\},\\\\{1,4\\\\},\\\\{1,3\\\\},\\\\{1,4\\\\}, \\\\{3,4\\\\} (we distinguish\nthe two 1s). The value of f(S) for these choices are 0,2,3,2,3,1,\nrespectively, for the total of 11.\n\n* * *"}, {"input": "6 3\n    10 10 10 -10 -10 -10", "output": "360\n    \n\nThere are 20 ways to choose S. In 18 of them, f(S)=20, and in 2 of them,\nf(S)=0.\n\n* * *"}, {"input": "3 1\n    1 1 1", "output": "0\n    \n\n* * *"}, {"input": "10 6\n    1000000000 1000000000 1000000000 1000000000 1000000000 0 0 0 0 0", "output": "999998537\n    \n\nPrint the sum \\bmod (10^9+7)."}]