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