import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); double b = sc.nextDouble(); double[] a = new double[n]; for(int i = 0; i < n; i++) { a[i] = sc.nextDouble(); } double ans1 = 0; double ans2 = 0; for(int i = 0; i < n; i++) { if(a[i] != 0) { ans1 += (a[i] * (double)Math.pow(b, a[i] - 1)); } if(a[i] == -1) { ans2 += (double)Math.log(b); } else { ans2 += ((a[i] + 1) * (double)Math.pow(b, a[i] + 1)); } } System.out.println(ans1); System.out.println(ans2); } }