#include<iostream>
#include<cstdio>
#include<cmath>
#define pi acos(-1)
using namespace std;
int n,L;
double T[101010],sumx,sumy;
void add(double x,int k)
{
	sumx+=cos(x)*k;
	sumy+=sin(x)*k;
}
int main()
{
	scanf("%d%d",&n,&L);
	for(int i=1;i<=n;i++)
	scanf("%lf",&T[i]),T[i]=T[i]/L*2.0*pi;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
		{
			double rad=(T[i]+T[j])/2.0;
			add(rad,n-j+i-1);
			add(rad+pi,j-i-1);
		}
	double num=1.0*n*(n-1)*(n-2)/6.0;
	printf("%.11lf %.11lf\n",sumx/num,sumy/num);
}	
		