#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<pii, lint> ppl;
typedef pair<lint, lint> pll;
typedef complex<double> xy_t;
typedef vector<lint> poly;

int main(){
    int n;
    double L;
    scanf("%d%lf", &n, &L);
    double t[n];
    rep(i, n) scanf("%lf", &t[i]);

    xy_t ans = xy_t(0);
    rep(i, n)For(j, i+1, n){
        xy_t m = polar(1.0, M_PI*(t[i]+t[j])/L);
        ans += m * 2.0 * (1.0*n-2.0*(j-i)) / (1.0*n*(n-1)*(n-2));
    }

    ans *= 3.0;
    printf("%.10lf %.10lf\n", ans.real(), ans.imag());
}