#include #include #include #include using namespace std; int main(){ int n,b;cin>>n>>b; vector A(n); for(int i = 0; n > i; i++){ cin>>A[i]; } //微分 double ans1 = 0; for(int i = 0; n > i; i++){ if(A[i] != 0.0){ ans1 += A[i]*pow(b,A[i]-1); } } double ans2 = 0; for(int i = 0; n > i; i++){ if(A[i] == -1.0){ ans2 += log(b); //cout << log(b) << " "; }else{ ans2 += pow(b,A[i]+1)/(A[i]+1); //cout << pow(b,A[i]+1)/(A[i]+1) << " "; } } //cout << endl; cout << fixed << setprecision(10) << ans1 << endl; cout << fixed << setprecision(10) << ans2 << endl; }