#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}; 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 + 1000000007 - fib[i - N]; sum %= 1000000007; sum += fib[i]; sum %= 1000000007; } int ret = 0; for (int i = 0; i < K; ++i) { ret += fib[i]; ret %= 1000000007; //cout << fib[i] << " "; } //cout << endl; cout << fib[K - 1] << " " << ret << endl; //} else { // cout << "1 1" << endl; //} return 0; }