using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { new Magatro().Solve(); } } class Magatro { private int N; private long K; private int[] A; private const int Mod = (int)1e9 + 7; private void Scan() { string[] s = Console.ReadLine().Split(' '); N = int.Parse(s[0]); K = long.Parse(s[1]); A = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); } public void Solve() { Scan(); if (K <= 1000000) { Easy(); } else { Hard(); } } private void Easy() { int s = 0; int sum = 0; var dp = new int[K + 1]; for(int i = 0; i < N; i++) { dp[i + 1] = A[i]; sum += A[i]; } sum %= Mod; for (int i = N + 1; i <= K; i++) { dp[i] = sum; sum *= 2; sum -= dp[i - N]; while (sum > 0) { sum += Mod; } sum %= Mod; } foreach(var i in dp) { s += i; s %= Mod; } Console.WriteLine($"{dp[K]} {s}"); } private void Hard() { } }