Problem:
Score : 100 points

Problem Statement

Given is a lowercase English letter C that is not z. Print the letter that follows C in alphabetical order.

Constraints

C is a lowercase English letter that is not z.

Input

Input is given from Standard Input in the following format:

C

Output

Print the letter that follows C in alphabetical order.

Sample Input 1

a

Sample Output 1

b

a is followed by b.

Sample Input 2

y

Sample Output 2

z

y is followed by z.

Solution in C++14 (GCC 5.4.1) (judge verdict: Runtime Error)

// clang-format off
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>

#include <algorithm>
#include <numeric>
#include <limits>
#include <chrono>
#include <functional>
#include <iterator>
#include <random>
#include <complex>
#include <utility>
#include <type_traits>
#include <tuple>
#include <memory>

#include <vector>
#include <array>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <valarray>

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <csignal>
#include <cstdint>
#include <cstddef>

#ifdef ONLINE_JUDGE
#define NDEBUG
#endif
#include <cassert>
#include <stdexcept>
#include <exception>

// << pair
template <typename T1, typename T2>std::ostream&operator<<(std::ostream&os,const std::pair<T1,T2>&p){return os<<"("<<p.first<<", "<<p.second<<")";}
// << container
template<typename,template<typename...> class...>struct is_instantiation_of:public std::false_type{};
template<template<typename...>class U,template<typename...>class...Us,typename...T>struct is_instantiation_of<U<T...>,U,Us...>:public std::true_type{};
template<typename S,template<typename...>class U,template<typename...>class...Us>struct is_instantiation_of<S,U,Us...>:std::integral_constant<bool,is_instantiation_of<S,Us...>::value>{};

template<typename C>std::ostream&_debug_go(std::ostream&,const C&);
template<typename C,typename=std::enable_if_t<is_instantiation_of<C,std::vector,std::deque,std::set,std::map,std::unordered_set,std::unordered_map,std::multiset,std::multimap,std::unordered_multiset,std::unordered_multimap,std::valarray>::value>>std::ostream&operator<<(std::ostream&os,const C&v){return _debug_go(os,v);}
template<typename T,std::size_t N> std::ostream& operator<<(std::ostream&os,const std::array<T,N>&v){return _debug_go(os,v);}
template<typename C>std::ostream& _debug_go(std::ostream&os,const C& v){bool first=true;os<<"[";for(auto i:v){if(!first)os<<", ";else first=false;os<<i;}return os<<"]";}

struct Debugger{template<typename T>Debugger&operator,(const T&v){std::cerr<<v<<" ";return *this;}} dbg;
#ifndef NDEBUG
#define debug(args...) do {dbg,args; cerr << "\n";} while(0)
#else
#define debug(args...)
#endif

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ITER(i, s, e) for (auto i((s)); i != (e); ++i)
#define IT(i, c) ITER(i, (c).begin(), (c).end())

using namespace std;

using ui = uint32_t;
using ll = int64_t;
using ull = uint64_t;
template <typename T = int> using Pt = complex<T>;

template <typename T>
T cross(const Pt<T>& a, const Pt<T>& b) { return a.real() * b.imag() - a.imag() * b.real(); }

template <typename T>
bool cmpPt(const Pt<T>& a, const Pt<T>& b) {
  return a.real() < b.real() || (a.real() == b.real() && a.imag() < b.imag());
}
// END TEMPLATE
// clang-format on

namespace algolib {
namespace NT {

template <typename Int>
inline std::tuple<Int, Int, Int> euclid(Int a, Int b) {
  Int r0 = a, s0 = 1, t0 = 0;
  Int r1 = b, s1 = 0, t1 = 1;
  Int q, rtmp, stmp, ttmp;
  while (r1) {
    q = r0 / r1;
    rtmp = r0 - q * r1, stmp = s0 - q * s1, ttmp = t0 - q * t1;
    r0 = r1, s0 = s1, t0 = t1;
    r1 = rtmp, s1 = stmp, t1 = ttmp;
  }
  return make_tuple(r0, s0, t0);
}

template <typename Int>
inline Int gcd(Int a, Int b) {
  return std::get<0>(euclid(a, b));
}

template <typename Int>
inline Int lcm(Int a, Int b) {
  return a / gcd(a, b) * b;
}

template <typename Int>
inline auto factor(Int n) {
  std::vector<std::pair<Int, int>> ret;
  for (Int i = 2; i <= n; ++i) {
    int ct = 0;
    while (n % i == 0) {
      n /= i;
      ++ct;
    }
    if (ct) ret.push_back({i, ct});
  }
  return ret;
}

template <typename Int>
inline Int pow(Int n, int64_t k) {
  Int res = 1;
  for (int x = 1; x <= k; x <<= 1) {
    if (k & x) res *= n;
    n *= n;
  }
  return res;
}

}  // namespace NT
}  // namespace algolib

namespace algolib {
namespace NT {

template <int M>
struct Modulo {
  static const int MOD = M;
  int val;
  Modulo() : val(0) {}
  Modulo(int64_t val) : val((val % M + M) % M) {}
  Modulo& operator+=(const Modulo& rhs) { return *this = val + rhs.val; }
  Modulo operator+() const { return +val; }
  Modulo operator-() const { return -val; }
  Modulo& operator-=(const Modulo& rhs) { return *this = *this + (-rhs); }
  Modulo& operator*=(const Modulo& rhs) { return *this = 1LL * val * rhs.val; }
  Modulo inv() const {
    auto res = euclid(val, M);
    int d = std::get<0>(res), x = std::get<1>(res);
    assert(d == 1 && "val should be coprime to M.");
    return x;
  }
  Modulo pow(int64_t k) const {
    if (k < 0) return inv().pow(-k);
    return NT::pow(*this, k);
  }
  Modulo& operator/=(const Modulo& rhs) { return *this *= rhs.inv(); }
  Modulo& operator++() { return *this += 1; }
  Modulo operator++(int) {
    int tmp = val;
    ++*this;
    return tmp;
  }
  Modulo& operator--() { return *this -= 1; }
  Modulo operator--(int) {
    int tmp = val;
    --*this;
    return tmp;
  }
  friend Modulo operator+(Modulo lhs, const Modulo& rhs) { return lhs += rhs; }
  friend Modulo operator-(Modulo lhs, const Modulo& rhs) { return lhs -= rhs; }
  friend Modulo operator*(Modulo lhs, const Modulo& rhs) { return lhs *= rhs; }
  friend Modulo operator/(Modulo lhs, const Modulo& rhs) { return lhs /= rhs; }
  friend bool operator==(const Modulo& lhs, const Modulo& rhs) {
    return lhs.val == rhs.val;
  }
  friend bool operator!=(const Modulo& lhs, const Modulo& rhs) {
    return lhs.val != rhs.val;
  }
  friend std::istream& operator>>(std::istream& is, Modulo& x) {
    int64_t n;
    is >> n;
    x = Modulo(n);
    return is;
  }
  friend std::ostream& operator<<(std::ostream& os, const Modulo& x) {
    return os << x.val;
  }
};

}  // namespace NT
}  // namespace algolib

constexpr int MOD = 1e9 + 7;
using Mod = algolib::NT::Modulo<MOD>;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  REP(i, N) cin >> A[i];

  sort(A.begin(), A.end());

  vector<Mod> C(N + 1, -1);
  REP(n, K - 1) C[n] = 0;
  C[K - 1] = 1;
  FOR(n, K - 1, N) C[n + 1] = C[n] * (n + 1) / (n + 1 - (K - 1));

  Mod ans = 0;
  REP(i, N) { ans += A[i] * (C[i] - C[N - 1 - i]); }

  cout << ans << '\n';

  return 0;
}