#include<bits/stdc++.h>
using namespace std;

const double pi=acos(-1.0);

double num[3010];
int n,l;

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

int main()
{
	n=rd();l=rd();
	for (int i=1;i<=n;i++) num[i]=rd();
	double ansx=0,ansy=0;
	for (int i=1;i<n;i++) for (int j=i+1;j<=n;j++)
	{
		ansx+=cos((num[i]+num[j])/l*pi)*(n-(j-i+1));
		ansy+=sin((num[i]+num[j])/l*pi)*(n-(j-i+1));
		ansx+=cos((num[i]+num[j]+l)/l*pi)*(j-i-1);
		ansy+=sin((num[i]+num[j]+l)/l*pi)*(j-i-1);
	}
	double all=(double)n*(n-1)*(n-2)/6;
	printf("%.15lf %.15lf\n",ansx/all,ansy/all);
	return 0;
}