#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
const double PI=acos(-1);
int n,L;
int T[3010];
int main()
{
	scanf("%d %d",&n,&L);
	for(int i=1;i<=n;i++)
		scanf("%d",&T[i]);
	double ansx=0,ansy=0;
	for(int i=1;i<n;i++)
		for(int j=i+1;j<=n;j++)
		{
			double x=cos(PI*(T[i]+T[j])/L),y=sin(PI*(T[i]+T[j])/L);
			int num=j-i-1;num=n-2-num;
			double p=(double)6*num/n/(n-1)/(n-2);
			ansx+=p*x;ansy+=p*y;
			x=-x;y=-y;num=n-2-num;
			p=(double)6*num/n/(n-1)/(n-2);
			ansx+=p*x;ansy+=p*y;
		}
	printf("%.10lf %.10lf\n",ansx,ansy);
	return 0;
}