#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pi; typedef pair pl; int main() { int N,B; cin >> N >> B; double fb=0, Fb=0; for (int i = 0; i < N; i++) { double a; cin >> a; if (a - 1 != 0) { fb += a*pow(B, a - 1); } if (a + 1 != 0) { Fb += 1 / (a + 1) * pow(B, a + 1); } else { Fb += log(B); } } printf("%.20f\n",fb); printf("%.20f\n", Fb); return 0; }