# https://yukicoder.me/problems/no/347 import math def differential(B, n): return n * B**(n-1) def integral(B, n): if n == -1: return math.log(B) return 1/(n+1) * B**(n+1) def main(): N = int(input()) B = int(input()) a = [float(i) for i in input().split()] differential_sum = 0 integral_sum = 0 for i in range(N): differential_sum += differential(B, a[i]) integral_sum += integral(B, a[i]) print(differential_sum) print(integral_sum) main()