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