#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define ll long long
#define maxn 3010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static char buf[20];
	int len=0;
	if(x<0)putchar('-'),x=-x;
	for(;x;x/=10)buf[len++]=x%10+'0';
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]);
}
inline void writesp(ll x){write(x); putchar(' ');}
inline void writeln(ll x){write(x); putchar('\n');}
const long double pi=3.14159265358979323846264338328;
int a[maxn];
int n,l;
int main()
{
	n=read(); l=read();
	for(int i=1;i<=n;i++)
		a[i]=read();
	long double x=0,y=0;
	for(int i=1;i<n;i++)
		for(int j=i+1;j<=n;j++){
			x+=cos(pi*(a[i]+a[j])/l)*(n-(j-i+1))+cos(pi*(a[i]+a[j])/l+pi)*(j-i-1);
			y+=sin(pi*(a[i]+a[j])/l)*(n-(j-i+1))+sin(pi*(a[i]+a[j])/l+pi)*(j-i-1);
		}
	x/=(ll)n*(n-1)*(n-2)/6;
	y/=(ll)n*(n-1)*(n-2)/6;
	printf("%.15Lf %.15Lf\n",x,y);
	return 0;
}