import math EPS = 1e-9 N = input() B = input() a = map(float, raw_input().split()) def f(x): res = 0 for i in xrange(len(a)): res += a[i] * (x**(a[i] - 1)) return res def F(x): res = 0 for i in xrange(len(a)): if -1.0 - EPS <= a[i] and a[i] <= -1.0 + EPS: res += math.log(x) else: res += x ** (a[i] + 1) / (1.0 * (a[i] + 1)) return res print f(B) print F(B)