/*input
10 100
2
11
35
42
54
69
89
91
93
99
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef __float128 ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define eb emplace_back
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define EL cout<<'\n'
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
	REP(i,SZ(V)) out<<V[i]<<((i!=SZ(V)-1)?" ":"");
	return out;
}
#define version 20190814
//}}}
const ll maxn=300005;
const ll maxlg=20;
const ll INF64=1e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

int n;
ll L;
ll a[maxn];

ld prex[maxn],prey[maxn];

ld q(int l,int r,ld *pre){
	if(l<r) return pre[r]-pre[l];
	else return pre[r]-(pre[n]-pre[l]);
}

pdd query(int l,int r){
	return MP(q(l,r,prex),q(l,r,prey));
}

ld cos(ld a){
	return cos((long double) a);
}
ld sin(ld a){
	return sin((long double) a);
}
ld hypot(ld a,ld b){
	return hypot((long double)a,(long double) b);
}

int main(){
	IOS;
	cin>>n>>L;
	REP(i,n) cin>>a[i];
	prex[0]=prey[0];

	for(int i=1;i<=n;i++){
		prex[i]=prex[i-1]+cos(PI*a[i-1]/L);
		prey[i]=prey[i-1]+sin(PI*a[i-1]/L);
	}

	pdd ans=MP(0,0);
	for(int i=0;i<n;i++) for(int j=i+2;j<n;j++){
		pdd upp=query(i+1,j);
		// cout<<upp<<'\n';
		pdd O=MP(cos((a[i]+a[j])*PI/L),sin((a[i]+a[j])*PI/L));
		O.F=-O.F;
		O.S=-O.S;
		// cout<<O<<'\n';
		ld R=hypot(O.F-cos(2*PI*a[i]/L),O.S-sin(2*PI*a[i]/L));
		ld len=a[j]-a[i];
		ld theta=(a[i]-(L-len)/4)/L*(2*PI)+PI/2;
		// cout<<theta/PI<<'\n';
		theta-=PI*a[i]/L;
		// cout<<theta/PI<<'\n';
		pdd rot=MP(upp.F*cos(theta)-upp.S*sin(theta),upp.F*sin(theta)+upp.S*cos(theta));
		rot.F*=R;
		rot.S*=R;
		rot.F+=O.F*(j-i-1);
		rot.S+=O.S*(j-i-1);
		ans.F+=rot.F;
		ans.S+=rot.S;
		// cout<<i<<' '<<j<<' '<<rot<<'\n';
	}
	ans.F/=(n*(n-1)*(n-2))/6;
	ans.S/=(n*(n-1)*(n-2))/6;
	cout<<fixed<<setprecision(12)<<(long double)ans.F<<' '<<(long double)ans.S<<'\n';
	return 0;
}
