#include<bits/stdc++.h>
using namespace std;

const int maxn=3005;
const double pi=acos(-1);
int n;
long long L;
long long t[maxn];

int main(){
	scanf("%d%lld",&n,&L);
	for(int i=1;i<=n;i++)scanf("%lld",&t[i]);
	double ansx=0,ansy=0;
	for(int i=1;i<=n;i++)for(int j=i+1;j<=n;j++){
		ansx+=(j-i-1)*cos(double(t[i]+t[j]+L)*pi/double(L));
		ansx+=(n+i-j-1)*cos(double(t[i]+t[j])*pi/double(L));
		ansy+=(j-i-1)*sin(double(t[i]+t[j]+L)*pi/double(L));
		ansy+=(n+i-j-1)*sin(double(t[i]+t[j])*pi/double(L));
	}
	double tot=double(n)*double(n-1)*double(n-2)/6.0;
	printf("%.15lf %.15lf\n",ansx/tot,ansy/tot);
	return 0;
}