#include<iostream>
#include<cstdio>
#include<cmath>
#define DB double
using namespace std;
int n,L,cnt;
DB ansx,ansy,tmp;
const int N=3005;
const DB PI=acos(-1);
DB t[N];
int main()
{
	cin>>n>>L;
	for(int i=1;i<=n;++i)scanf("%lf",&t[i]);
	for(int i=1;i<=n;++i)
		for(int j=i+1;j<=n;++j)
		{
			cnt=j-i-1;tmp=PI*(t[i]+t[j])/L;
			ansx+=cos(tmp)*(n-2*cnt-2);ansy+=sin(tmp)*(n-2*cnt-2);
		}
	ansx/=(DB)n*(n-1)*(n-2)/6;ansy/=(DB)n*(n-1)*(n-2)/6;
	printf("%0.12f %0.12f",ansx,ansy);
	return 0;
}