#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);
const long double pi = acos(-1.0L);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}



int main(void){
	int n,i,j;
	long double l,t[3333],x=0.0,y=0.0;
	cin >> n >> l;
	for(i=0; i<n; ++i){
		cin >> t[i];
		for(j=0; j<i; ++j){
			x -= (cos((t[i]+t[j])*pi/l))*(i-j-1);
			y -= (sin((t[i]+t[j])*pi/l))*(i-j-1);
			x += (cos((t[i]+t[j])*pi/l))*(n-2-(i-j-1));
			y += (sin((t[i]+t[j])*pi/l))*(n-2-(i-j-1));
		}
	}
	x *= 6; x /= n; x /= (n-1); x /= (n-2);
	y *= 6; y /= n; y /= (n-1); y /= (n-2);
	cout << fixed << setprecision(50) << x << " " << y << endl;
	return 0;
}
