#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define mp make_pair #define pb push_back #define all(x) (x).begin(),(x).end() #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector vb; typedef vector vi; typedef vector vvb; typedef vector vvi; typedef pair pii; const int INF=1<<29; const double EPS=1e-9; const int dx[]={1,0,-1,0},dy[]={0,-1,0,1}; const long long int MOD = 1000000007ll; vvi mul_(vvi &A, vvi &B) { vvi C(A.size(), vi(B[0].size(), 0)); 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] = ((ll)A[i][k] * B[k][j] + C[i][j]) % MOD; } } } return C; } vvi mul(vvi A, long long int n) { vvi B(A.size(), vi(A[0].size(), 0)); for (int i = 0; i < B.size(); ++i) { B[i][i] = 1; } while(n > 0) { if (n & 1) { B = mul_(B, A); } A = mul_(A, A); n >>= 1; } return B; } int main(int argc, char const *argv[]) { long long int N, K; cin >> N >> K; if (N <= 10000 && K <= 1000000) { std::vector fib(K); int sum = 0; for (int i = 0; i < N; ++i) { int temp; cin >> temp; sum += temp; fib[i] = temp; } for (int i = N; i < K; ++i) { fib[i] = sum; sum = sum + MOD - fib[i - N]; sum %= MOD; sum += fib[i]; sum %= MOD; } int ret = 0; for (int i = 0; i < K; ++i) { ret += fib[i]; ret %= MOD; //cout << fib[i] << " "; } //cout << endl; cout << fib[K - 1] << " " << ret << endl; } else { vvi G(N + 1, vi(N + 1, 0)); G[0][0] = 2; G[0][G[0].size() - 1] = MOD - 1; for (int i = 0; i < G.size() - 1; ++i) { G[i + 1][i] = 1; } G = mul(G, K - N); vi v(N + 1); int sum = 0; v[v.size() - 1] = 0; for (int i = 0; i < v.size() - 1; ++i) { int temp; cin >> temp; sum += temp; v[v.size() - i - 2] = sum; } long long int Sk = 0, Sk_ = 0; for (int i = 0; i < N; ++i) { Sk += (ll)G[0][i] * v[i] % MOD; } for (int i = 0; i < N; ++i) { Sk_ += (ll)G[1][i] * v[i] % MOD; } cout << (Sk - Sk_ + MOD) % MOD << " " << Sk % MOD << endl; } return 0; }