#include using namespace std; typedef long long LL; #define CIN_ONLY if(1) struct cww{cww(){ CIN_ONLY{ ios::sync_with_stdio(false);cin.tie(0); } }}star; #define fin "\n" #define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() #define fi first #define se second #define pb push_back #define DEBUG if(0) #define REC(ret, ...) std::function template inline bool chmin(T &l,T r) {bool a=l>r;if(a)l=r;return a;} template inline bool chmax(T &l,T r) {bool a=l istream& operator>>(istream &is,vector &v){ for(auto &it:v)is>>it; return is; } const int mod=1e9+7; typedef LL D; #define REP4(i,n) for(int i=0;i P; P case1(){ FOR(i,N,K){ A[i] = (mod + S[i] - S[i - N]) % mod; S[i+1] = (A[i] + S[i])%mod; } return P(A[K-1],S[K]); } P case2(){ P res; { REP(i,N)REP(j,N)mat[0](i,j)=0; REP(i,N-1)mat[0](i+1,i)=1; REP(i,N)mat[0](0,i)=1; REP(i,50)mat_mul(mat[i],mat[i],mat[i+1]); LL bit=K-N; vector f(N); REP(i,N)f[i]=A[i]; reverse(ALL(f)); for(int l=0;bit;l++,bit>>=1){ if(bit&1){ vector g(N); REP(i,N)REP(j,N)g[i]+=mat[l](i,j)*f[j]%mod; REP(i,N)g[i]%=mod; swap(f,g); } } res.fi=f.front(); } { REP(i,N)REP(j,N)mat[0](i,j)=0; REP(i,N-1)mat[0](i+1,i)=1; mat[0](0,0)=2; mat[0](0,N-1)=1; REP(i,50)mat_mul(mat[i],mat[i],mat[i+1]); LL bit=K-N; vector f(N); REP(i,N)f[i]=S[i+1]; reverse(ALL(f)); for(int l=0;bit;l++,bit>>=1){ if(bit&1){ vector g(N); REP(i,N)REP(j,N)g[i]+=mat[l](i,j)*f[j]%mod; REP(i,N)g[i]%=mod; swap(f,g); } } res.se=f.front(); } return res; } int main(void){ cin >> N >> K; S[0]=0; REP(i,N){ cin >> A[i]; S[i+1] = S[i] + A[i]; S[i] %= mod; } pair res; if (K <= 1000000)res= case1(); else res = case2(); cout << res.fi << " " << res.se << endl; return 0; }