#coding: UTF-8 import sys from math import log from collections import deque from functools import reduce ### defs ### def diff(A,B): return sum(map(lambda a:a*B**(a-1), A)) def integ(A,B): return sum(map(lambda a:B**(a+1)/(a+1) if a!=-1.0 else log(B),A)) ### main ### N = int(sys.stdin.readline()) B = int(sys.stdin.readline()) A = list(map(float,sys.stdin.readline().split())) print(diff(A,B)) print(integ(A,B))