#include <bits/stdc++.h>

#define rep(i, n) for(int (i) = 0; i < (n); ++(i))

typedef long long ll;
const ll MOD = 1e9 + 7;

const int MAX = 100001;
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  int N, K;
  std::cin >> N >> K;
  std::vector<ll> A(N);
  rep(i, N) {
    std::cin >> A[i];
  }

  std::sort(A.begin(), A.end());
  COMinit();

  ll ans = 0;
  rep(i, N) {
    ans += COM(i, K - 1) * A[i] % MOD;
    ans %= MOD;
    ans -= COM(N - i - 1, K - 1) * A[i] % MOD;
    ans %= MOD;
  }

  std::cout << ans << '\n';
}
