#include #include #include #include using namespace std; int main() { int n, b; cin >> n >> b; vector a(n, 0); for (int i = 0; i < n; i++) { cin >> a[i]; } double x1, x2; x1 = x2 = 0; for (int i = 0; i < n; i++) { x1 += a[i] * pow(b, a[i] - 1.0); if (a[i] == -1.0) { x2 += log(b); } else { x2 += 1.0 / (a[i] + 1) * pow(b, a[i] + 1.0); } } printf("%.15f\n", x1); printf("%.15f\n", x2); return 0; }