#include<bits/stdc++.h>
using namespace std;
#define int long long
const double pi=acos(-1.0);
const int N=3000+5;
int n,L,a[N];
signed main(){
	cin>>n>>L;
	for(int i=1;i<=n;++i)
		cin>>a[i];
	long double x=0,y=0;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j)
			if(i!=j){
				int l=a[i],r=(a[i]<a[j])?a[j]:a[j]+L;
				int tmp=(j-i+n)%n+1;
				x+=(long double)(n-tmp)*cos(pi*(l+r)/L);
				y+=(long double)(n-tmp)*sin(pi*(l+r)/L);
			}
	long long c=1ll*n*(n-1)*(n-2)/6;
	//cout<<x<<" "<<y<<endl;
	printf("%.9lf %.9lf",(double)x/c,(double)y/c);
	return 0;
}