N, K = map(int, input().split()) table = list(map(int, input().split())) restable = [] nums = None sumnum = 0 MOD = 1000000007 if K > 100001: exit(0) for i in range(0, K): # debug print # print(table, i) # print(restable, i) if i < N: f = table[i] else: if nums == None: nums = sum(restable[i-N:i]) % MOD else: # print(restable[i - 1], restable[i - 1 - N], i) nums += restable[i - 1] - restable[i - 1 - N] f = nums % MOD restable.append(f) sumnum += f sumnum %= MOD print(restable[len(restable) - 1], sumnum)