#include <bits/stdc++.h>
using namespace std;
#define Maxn 3007
int n,a[Maxn],l;
const double pi=acos(-1.0);
int main()
{
    scanf("%d%d",&n,&l);
    for (int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    double ansx=0.0,ansy=0.0;
    for (int i=1;i<=n;i++)
        for (int j=i+1;j<=n;j++)
        {
            double tmpx=cos(pi*(a[i]+a[j])/(1.0*l));
            double tmpy=sin(pi*(a[i]+a[j])/(1.0*l));
            ansx+=tmpx*(n-2-(j-i-1));
            ansy+=tmpy*(n-2-(j-i-1));
            tmpx=cos(pi+pi*(a[i]+a[j])/(1.0*l));
            tmpy=sin(pi+pi*(a[i]+a[j])/(1.0*l));
            ansx+=tmpx*(j-i-1);
            ansy+=tmpy*(j-i-1);
        }
    double r=1.0*n*(n-1)*(n-2)/6.0;
    ansx/=r;
    ansy/=r;
    printf("%.15lf %.15lf\n",ansx,ansy);
    return 0;
}