#include<bits/stdc++.h>
const int N=3003;
typedef long double ld;
const ld pi=acos(-1);
using namespace std;
int n,m,a[N];
ld x,y;
inline void pls(long long d,int v){
	x+=v*cos(pi*d/m),y+=v*sin(pi*d/m);
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d",a+i);
		for(int j=0;j<i;j++)
		pls(a[i]+a[j],j+n-i-1),
		pls(1ll*a[i]+a[j]+m,i-j-1);
	}
	printf("%.10Lf %.10Lf",x*6/n/(n-1)/(n-2),
	y*6/n/(n-1)/(n-2));
}