#include<bits/stdc++.h>
const double pi=acos(-1);
int n,L,T[3005],i,j,k;
double x,y,z;
int main(){
	scanf("%d%d",&n,&L);
	for(i=1;i<=n;++i)scanf("%d",T+i);
	for(i=1;i<n;++i)for(j=i+1;j<=n;++j){
		z=(T[i]+T[j])*pi/L;k=i-1+n-j-(j-i-1);
		x+=cos(z)*k;y+=sin(z)*k;
	}
	x/=1ll*n*(n-1)*(n-2)/6;y/=1ll*n*(n-1)*(n-2)/6;
	printf("%.12f %.12f\n",x,y);
	return 0;
}