import math N = int(input()) B = int(input()) As = list(map(float, input().split())) def solve(N, B, As): x1 = 0 x2 = 0 for a in As: x1 += a * B ** (a-1) if a != -1: x2 += (B ** (a + 1))/(a + 1) else: x2 += math.log(B) return x1, x2 x1, x2 = solve(N, B, As) print(x1) print(x2)