#include<bits/stdc++.h>
using namespace std;
const int N=4000;
typedef double ld;
const ld PI=acos(-1);
typedef complex<ld>C;
C c[N],ans;
int n,L;
int main(){
#ifdef ONLINE_JUDGE
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#endif
	cin>>n>>L;
	for(int i=1;i<=n;++i){
		int x;cin>>x;
		c[i]=C(cos(x*PI/L),sin(x*PI/L));
	}
	for(int i=1;i<=n;++i){
		C tmp(0,0),sum(0,0);
		for(int j=i+1;j<=n;++j){
			ans+=tmp*c[j];
			tmp+=c[j];
			sum+=tmp-C(j-i,0)*c[j];
		}
		ans+=sum*c[i];
	}
	long long count=1ll*n*(n-1)*(n-2)/6;
	cout<<setprecision(15)<<ans.real()/count<<' '<<ans.imag()/count<<endl;
	return 0;
}

