#include int main() { std::vector v; long N, K; long total = 0; long temp; long num; long last = 0; long minus; std::cin >> N >> K; if( K < 1000000 ) { total = 0; for(int i = 0; i < N; ++i) { std::cin >> temp; v.push_back(temp); } num = 0; for(long t : v) { num += t; } total = num; for(int i = N; i < K; ++i) { minus = v[i%N]; v[i%N] = (num); last = num; total += num; total %= 1000000007; num *= 2; num -= minus; } //total = 0; for(int i = 0; i < K; ++i) { //std::cout << "#" << f[i] << std::endl; //total += f[i]; //total %= 1000000007; } } std::cout << last << " " << total << std::endl; return 0; }