#include<bits/stdc++.h>
using namespace std;
#define db double
const db pi=acos(-1);

int n, l, a[3030];
db anx, any;

int main(){
    cin>>n>>l;
    for (int i=1;i<=n;++i) cin>>a[i];
    sort(a+1,a+n+1);
    for (int i=1;i<=n;++i)
        for (int j=i+1;j<=n;++j){
            db p1=(a[i]+a[j])*pi/l, p2=p1+pi;
            int c1=n-(j-i+1), c2=j-i-1;;
            anx+=cos(p1)*c1+cos(p2)*c2;
            any+=sin(p1)*c1+sin(p2)*c2;
        }
    db fm=1./6*n*(n-1)*(n-2);
    printf("%.10lf %.10lf\n",anx/fm,any/fm);
}