import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def SI(): return sys.stdin.readline()[:-1] class Sibonacci: def __init__(self, aa): n = len(aa) + 1 coff = [-1] + [0] * (n - 2) + [2] f0 = [aa[0]] for x in range(1, n - 1): f0.append(f0[-1] + aa[x]) f0.append(f0[-1] * 2) self.f0 = f0 # 上2つは問題ごとに手作業で設定 # af(n)+bf(n+1)+cf(n+2)+df(n+3)=f(n+4)みたいなとき # coff=[a,b,c,d] # 初期値f0(f(0)からf(3)) ff = [[0] * n for _ in range(2 * n - 1)] for i in range(n): ff[i][i] = 1 for i in range(n, 2 * n - 1): ffi = ff[i] for j, c in enumerate(coff, i - n): ffj = ff[j] for k in range(n): ffi[k] += c * ffj[k] self.bn = 1 << (n - 1).bit_length() self.base = ff[self.bn] self.ff = ff self.n = n def __mm(self, aa, bb): n = self.n res = [0] * (n * 2 - 1) for i, a in enumerate(aa): for j, b in enumerate(bb): res[i + j] += a * b % md for i in range(n, 2 * n - 1): c = res[i] ffi = self.ff[i] for j in range(n): res[j] += c * ffi[j] res[j] %= md return res[:n] def v(self, x): base = self.base aa = self.ff[x % self.bn] x //= self.bn while x: if x & 1: aa = self.__mm(aa, base) base = self.__mm(base, base) x >>= 1 return sum(a * f % md for a, f in zip(aa, self.f0)) % md md = 10 ** 9 + 7 def main(): n, k = MI() f0 = LI() s = Sibonacci(f0) print((s.v(k - 1) - s.v(k - 2)) % md, s.v(k - 1)) main()