import math n = int(raw_input()) b = int(raw_input()) l = map(float, raw_input().split()) x = 0.0 y = 0.0 for f in l: x += (b ** (f-1)) * f if f == -1.0: y += math.log(abs(b)) else: y += (b ** (f+1)) / (f+1) print x print y