#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b-1);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  u64 &value() noexcept { return a; }
  u64 &value() const noexcept { return a; }
  modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
  modint pow(u64 exp){
    modint res=1,rhs=*this;
    while (exp) {
      if (exp % 2) {
        res *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return res;
  }

  friend ostream& operator<<(ostream& os,modint& rhs){
    os << rhs.value();
    return os;
  }

  friend istream& operator>>(istream &is,modint &rhs){
      is>>rhs.value();
      rhs.value()%=Modulus;
      return is;
  }

};

using mint=modint<(int)1e9+7>;
struct factorial{
  vector<mint>fact,inv;
  factorial(int n){
    fact.assign(n,0);
    inv.assign(n,0);
    fact[0]=1;
    for(int i=0;i<n-1;i++){
      fact[i+1]=fact[i]*(i+1);
    }
    inv[n-1]=(mint)1/fact[n-1];
    for(int i=n-1;i>=1;i--){
      inv[i-1]=inv[i]*i;
    }
  }
  mint comb(int a,int b){
    if(b>a||b<0)return 0;
    if(a==0&&b==0)return 1;
    return fact[a]*inv[b]*inv[a-b];
  }

};

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,k;cin>>n>>k;
  vector<ll>a(n);
  rep(i,n)cin>>a[i];
  sort(all(a));
  mint res=0;
  factorial f(n+7);
  rep(i,n){
    mint wei=0;
    wei+=f.comb(i,k-1);
    wei-=f.comb(n-i-1,k-1);
    /*
    cout<<f.comb(i,k-1).value()<<endl;
    cout<<f.comb(n-1-i,k-1).value()<<endl;
    cout<<wei<<endl;
    */
    if(a[i]<0)res-=wei*abs(a[i]);
    else res+=wei*abs(a[i]);
    //cout<<res<<endl;

  }
  cout<<res<<endl;

  return 0;

}


Measured memory_bytes: 2560