#include <stdio.h>
#include <math.h>
const int N=3e3+10;
const long double pi=acos(-1);
int main(){
	int n,a[N],pos,l;
	long double x=0,y=0;
  	scanf("%d%d",&n,&l);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)for(int j=i+1;j<=n;j++){
		long double theta=(a[i]+a[j])*pi/l;
      	int cnt1=j-i-1;
      	int cnt2=n-2-cnt1;
		x+=cos(theta)*(cnt2-cnt1);
		y+=sin(theta)*(cnt2-cnt1);
	}
	long long int tot=1LL*n*(n-1)*(n-2)/6;
	printf("%.20Lf %.20Lf\n",x/tot,y/tot);
}