#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
#define PB push_back
#define CL(a,x) memset(a, x, sizeof(a))
typedef long long LL;
const int P = 998244353;
const int N = 3005;
const double PI = acos(-1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, L, a[N];

int main(){
	cin>>n>>L;
	rep(i,1,n)cin>>a[i];
	double ansx = 0, ansy = 0;
	rep(i,1,n-1)rep(j,i+1,n){
		double angle = PI * (a[i]+a[j]) / L;
		int k = j - i - 1;
		ansx += cos(angle) * (n-2*k-2);
		ansy += sin(angle) * (n-2*k-2);
	}
	ansx *= 6.0/n/(n-1)/(n-2), ansy *= 6.0/n/(n-1)/(n-2);
	cout<<setprecision(15)<<fixed<<ansx<<" "<<ansy<<endl;
	return 0;
}