#!/usr/bin/python mod = int(1e9) + 7 def solve1(n, k, a): y = 0 for i in xrange(n): y = (y + a[i]) % mod z = y for i in xrange(k-n): a.append(z) y = (y + z) % mod z = (z + z - a[i]) % mod return a[-1], y def matmul(A, B): rows, cols, times = len(A), len(B[0]), len(A[0]) res = [[0 for _ in xrange(cols)] for _ in xrange(rows)] for r in xrange(rows): for c in xrange(cols): res[r][c] = sum(A[r][i]*B[i][c] for i in xrange(times)) % mod return res def matpow(A, n): sz = len(A) res = [[1 if i==j else 0 for i in xrange(sz)] for j in xrange(sz)] while n > 0: if n & 1: res = matmul(res, A) A = matmul(A, A) n >>= 1 return res def solve2(n, k, a): s = zip([sum(a[:i]) for i in xrange(len(a)+1)][::-1]) mat = [[0 for _ in xrange(n+1)] for _ in xrange(n+1)] mat[0][0] = 2 for i in xrange(n): mat[i+1][i] = 1 mat[0][n] = -1 powered = matpow(mat, k-n) res = matmul(powered, s) x, y = res[0][0], res[1][0] return (x-y) % mod, x n, k = map(int, raw_input().split()) As = map(int, raw_input().split()) if k <= int(1e6): res = solve1(n, k, As) else: res = solve2(n, k, As) print ' '.join(map(str, res))