#include <bits/stdc++.h>
using namespace std;

const double PI = acos(-1);

int main(){
    int N, L, T[3000];
    cin >> N >> L;
    for(int i=0; i<N; i++) cin >> T[i];

    double ansX = 0, ansY = 0;
    for(int i=0; i<N; i++) for(int j=i+1; j<N; j++){
        int inter = j-i-1;
        int outer = N-inter-2;
        double theta = PI * (T[i]+T[j]) / L;
        ansX += (outer - inter) * cos(theta);
        ansY += (outer - inter) * sin(theta);
    }
    int64_t comb = int64_t(N) * (N-1) * (N-2) / 6;
    ansX /= comb;
    ansY /= comb;
    cout << fixed << setprecision(15) << ansX << " " << ansY << endl;
    return 0;
}
