#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

namespace edamat {
constexpr std::uint_fast64_t totient(std::uint_fast64_t x) noexcept {
    using u64 = std::uint_fast64_t;
    u64 ret = x;
    for(u64 i = static_cast<u64>(2); i * i <= x; ++i) {
        if(x % i == static_cast<u64>(0)) {
            ret -= ret / i;
            x /= i;
            while(x % i == static_cast<u64>(0)) {
                x /= i;
            }
        }
    }
    if(x != static_cast<u64>(1)) {
        ret -= ret / x;
    }
    return ret;
}

template <std::uint_fast64_t Modulus,
          std::uint_fast64_t InverseExp =
              totient(Modulus) - static_cast<std::uint_fast64_t>(1)>
class modint {
    using u64 = std::uint_fast64_t;

    static_assert(Modulus < static_cast<u64>(1) << static_cast<u64>(32),
                  "Modulus must be less than 2**32");

    u64 a;

    constexpr modint &negate() noexcept {
        if(a != static_cast<u64>(0)) {
            a = Modulus - a;
        }
        return *this;
    }

   public:
    constexpr modint(const u64 x = static_cast<u64>(0)) noexcept
        : a(x % Modulus) {}
    constexpr u64 &value() noexcept { return a; }
    constexpr const u64 &value() const noexcept { return a; }
    constexpr modint operator+() const noexcept { return modint(*this); }
    constexpr modint operator-() const noexcept {
        return modint(*this).negate();
    }
    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;
    }
    constexpr modint operator/(const modint rhs) const noexcept {
        return modint(*this) /= rhs;
    }
    constexpr modint &operator+=(const modint rhs) noexcept {
        a += rhs.a;
        if(a >= Modulus) {
            a -= Modulus;
        }
        return *this;
    }
    constexpr modint &operator-=(const modint rhs) noexcept {
        if(a < rhs.a) {
            a += Modulus;
        }
        a -= rhs.a;
        return *this;
    }
    constexpr modint &operator*=(const modint rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }
    constexpr modint &operator/=(modint rhs) noexcept {
        u64 exp = InverseExp;
        while(exp) {
            if(exp % static_cast<u64>(2) != static_cast<u64>(0)) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= static_cast<u64>(2);
        }
        return *this;
    }
    constexpr bool operator==(const modint rhs) const noexcept {
        return a == rhs.a;
    }
    constexpr bool operator!=(const modint rhs) const noexcept {
        return a != rhs.a;
    }
    friend std::ostream &operator<<(std::ostream &s, modint a) {
        s << a.value();
        return s;
    }
    friend std::istream &operator>>(std::istream &s, modint &a) {
        i64 ret;
        s >> ret;
        a = modint(ret);
        return s;
    }
};

template <class T, std::uint_fast64_t v>
class modint_constant {
   public:
    static constexpr T value = static_cast<T>(v);

    using value_type = T;
};
template <class T, std::uint_fast64_t v>
constexpr T modint_constant<T, v>::value;

}  // namespace edamat
using modint = edamat::modint<1000000007>;

namespace std {
template <typename T>
T pow(T a, int_fast64_t n, T e = 1) {
    T ret = e;
    while(n) {
        if(n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
};
}  // namespace std

// 二項係数ライブラリ
template <class T>
struct BiCoef {
    std::vector<T> fact_, inv_, finv_;
    constexpr BiCoef() {}
    constexpr BiCoef(int n) noexcept : fact_(n, 1), inv_(n, 1), finv_(n, 1) {
        init(n);
    }
    constexpr void init(int n) noexcept {
        fact_.assign(n, 1), inv_.assign(n, 1), finv_.assign(n, 1);
        int MOD = (1e9 + 7);
        for(int i = 2; i < n; i++) {
            fact_[i] = fact_[i - 1] * i;
            inv_[i] = -inv_[MOD % i] * (MOD / i);
            finv_[i] = finv_[i - 1] * inv_[i];
        }
    }
    constexpr T com(int n, int k) const noexcept {
        if(n < k || n < 0 || k < 0) return 0;
        return fact_[n] * finv_[k] * finv_[n - k];
    }
    constexpr T fact(int n) const noexcept {
        if(n < 0) return 0;
        return fact_[n];
    }
    constexpr T inv(int n) const noexcept {
        if(n < 0) return 0;
        return inv_[n];
    }
    constexpr T finv(int n) const noexcept {
        if(n < 0) return 0;
        return finv_[n];
    }
};

BiCoef<modint> bc;

void solve() {
    int n, k;
    std::cin >> n >> k;
    std::vector<i64> a(n);
    rep(i, n) std::cin >> a[i];
    std::sort(begin(a), end(a));
    bc.init(110000);
    modint ans = 0;
    rep(i, n) {  // maxを足していく
        if(a[i] < 0) {
            ans -= bc.com(i, k - 1) * std::abs(a[i]);
        } else {
            ans += bc.com(i, k - 1) * a[i];
        }
    }
    rep(i, n) {  // minを引いていく
        if(a[i] < 0) {
            ans += bc.com(n - i - 1, k - 1) * std::abs(a[i]);
        } else {
            ans -= bc.com(n - i - 1, k - 1) * modint(a[i]);
        }
    }
    std::cout << ans << std::endl;
}

int main() {
    // std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 3584