#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3005;
#define sz(v) ((int)(v).size())
using pi = complex<double>;

int main(){
	int n, l;
	scanf("%d %d",&n,&l);
	vector<pi> a(n);
	for(int i=0; i<n; i++){
		int x; cin >> x;
		a[i] = pi(cos(acos(-1) * x / l), sin(acos(-1) * x / l));
	}
	auto ret = pi(0, 0);
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			int L = i, M = j - i - 1, R = n - j - 1;
			ret += (1.0 * L + R - M) * (a[i] * a[j]);
		}
	}
	ret /= (1.0 * n * (n-1) * (n-2) / 6);
	printf("%.10f %.10f\n", ret.real(), ret.imag());
}
