from math import log N = int(input()) B = int(input()) A = tuple(map(float, input().split())) df = sum(B ** (a - 1) * a for a in A) F = sum(B ** (a + 1) / (a + 1) if a != -1.0 else log(B) for a in A) print(df, F)