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: nk = input().split()
  n = int(nk[0])
  k = int(nk[1])
  a = [int(s) for s in input().split()]
  a.sort()
  fx = 0
  for j in range(n):
      if j >= k - 1:
          jCk_1 = 1
          for i in range(k - 1):
              jCk_1 = jCk_1 * (j - i) / (i + 1)
          fx = fx + jCk_1 * a[j]
      if n - j - 1 >= k - 1:
          jCk_1 = 1
          for i in range(k - 1):
              jCk_1 = jCk_1 * (n - j - 1 - i) / (i + 1)
          fx = fx - jCk_1 * a[j]
  print(str(int(fx % (10**9 + 7))))
  
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)."}]