from math import log N = int(input()) B = int(input()) A = list(map(float, input().split())) a1 = 0 a2 = 0 for a in A: a1 += a * pow(B, a - 1) if a == -1: a2 += log(B) else: a2 += pow(B, a + 1) / (a + 1) print(a1) print(a2)