#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n; double b; cin >> n >> b; vector a(n); rep(i, n) cin >> a[i]; { double ans = 0; rep(i, n) ans += a[i] * pow(b, a[i] - 1); cout << fixed << setprecision(15) << ans << '\n'; } { double ans = 0; rep(i, n) { if (a[i] == -1) ans += log(b); else ans += 1.0 / (a[i] + 1) * pow(b, a[i] + 1); } cout << fixed << setprecision(15) << ans << '\n'; } return 0; }