import math n = int(input()) b = int(input()) a = list(map(float, input().split())) f = 0 F = 0 for i in a: f += i * b**(i-1) if i != -1.0: F += 1/(i+1) * b**(i+1) else: F += math.log(b) print(f) print(F)