#include<bits/stdc++.h>
using namespace std;
const int N=4000;
const double PI=acos(-1);
typedef complex<double>C;
C sum1,sum2,ans;
int n,L;
int main(){
	cin>>n>>L;
	for(int i=1;i<=n;++i){
		int x;cin>>x;C a(cos(x*PI/L),sin(x*PI/L));
		ans+=sum1*a+sum2*C(n-2*i)*a;
		sum1+=C(2*i,0)*a;sum2+=a;
	}
	long long count=1ll*n*(n-1)*(n-2)/6;
	cout<<setprecision(15)<<ans.real()/count<<' '<<ans.imag()/count<<endl;
	return 0;
}