#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) #define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++) #define ALL(x) (x).begin(), (x).end() const double PI = acos(-1); double f(const vector &a, double b) { double ret = 0; REP (i, a.size()) ret += a[i] * pow(b, a[i]-1); return ret; } double F(const vector &a, double b) { double ret = 0; REP (i, a.size()) { if (a[i] == -1) ret += log(b); else ret += 1.0 / (a[i]+1) * pow(b, a[i]+1); } return ret; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; double b; cin >> n >> b; vector a(n); REP (i, n) cin >> a[i]; cout << fixed << setprecision(12); cout << f(a, b) << endl; cout << F(a, b) << endl; return 0; }