#include<cstdio>
#include<cmath>
#define RI register int
#define CI const int&
using namespace std;
const int N=3005;
const double pi=acos(-1);
int n,l,t[N],cur; double ansx,ansy;
int main()
{
    RI i,j; for (scanf("%d%d",&n,&l),i=1;i<=n;++i) scanf("%d",&t[i]);
    for (i=1;i<n;++i) for (cur=0,j=i+1;j<=n;++j,++cur)
    {
        ansx+=1.0*(n-2-cur)*cos(pi*(t[i]+t[j])/l)/(n-2);
        ansy+=1.0*(n-2-cur)*sin(pi*(t[i]+t[j])/l)/(n-2);
        ansx-=1.0*cur*cos(pi*(t[i]+t[j])/l)/(n-2);
        ansy-=1.0*cur*sin(pi*(t[i]+t[j])/l)/(n-2);
    }
    double ct=1.0*n*(n-1)/2.0; ansx/=ct; ansy/=ct;
    return printf("%.16lf %.16lf",3.0*ansx,3.0*ansy),0;
}