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