#include using namespace std; typedef long long ll; typedef vector vec; typedef vector mat; #define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, a) REP(i, 0, a) #define EACH(i, a) for (auto i: a) #define ITR(x, a) for (__typeof(a.begin()) x = a.begin(); x != a.end(); x++) #define ALL(a) (a.begin()), (a.end()) #define HAS(a, x) (a.find(x) != a.end()) int N; ll K; const ll mod = 1000000007; int A[10005]; mat mat_mul(mat &A, mat &B) { mat C(A.size(), vec(B[0].size())); for (int i = 0; i < A.size(); i++) for (int k = 0; k < B.size(); k++) for (int j = 0; j < B[0].size(); j++) C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % mod; return C; } mat mat_pow(mat A, ll n) { mat B(A.size(), vec(A.size())); for (int i = 0; i < A.size(); i++) B[i][i] = 1; while (n) { if (n & 1) B = mat_mul(B, A); A = mat_mul(A, A); n >>= 1; } return B; } void solve1() { ll F = 0, S = 0; rep(i, N) A[N] += A[i], S += A[i]; REP(i, N + 1, K + 1) { S = (S + A[i - 1]) % mod; A[i] = (2 * A[i - 1] - A[i - N - 1]) % mod; } cout << A[K - 1] << " " << S << endl; } void solve2() { mat MB(N + 1, vec(1)); rep(i, N) MB[N - i][0] = A[i]; rep(i, N) MB[0][0] += A[i]; mat MA(N + 1, vec(N + 1)); rep(i, N + 1) MA[0][i] = 1; rep(i, N) MA[1][i + 1] = 1; rep(i, N - 1) MA[i + 2][i + 1] = 1; MA = mat_pow(MA, K - N); MB = mat_mul(MA, MB); cout << MB[1][0] << " " << MB[0][0] << endl; } int main(void) { cin >> N >> K; rep(i, N) cin >> A[i]; if (N > 30) solve1(); else solve2(); return 0; }