#include <bits/stdc++.h>
using namespace std;

const int N = 3300;

int t[N*2];
long double x[N];
long double y[N];
long double sumb[N*2];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, L; cin >> n >> L;
	for (int i = 0; i < n; i++) cin >> t[i];
	for (int i = 0; i < n; i++) t[i + n] = t[i];
	const long double PI = acosl(-1);
	for (int i = 0; i < n; i++) {
		x[i] = cosl(PI * 2 * t[i] / L);
		y[i] = sinl(PI * 2 * t[i] / L);
	}
	long double sumx = 0, sumy = 0;
	for (int i = 0; i < n; i++) {
		for (int j = n + i; j > i; j--) {
			int ang = (t[i] - t[j] + L) % L;
			sumb[j] = j == n + i ? 0 : sumb[j + 1] + tanl(ang * PI / L / 2);
		}
		for (int j = i + 1; j < n + i - 1; j++) {
			int ang = (t[j] - t[i] + L) % L;
			long double cur = -tanl(ang * PI / L / 2) * sumb[j + 1] + (n + i - j - 1);
			sumx += cur * x[i];
			sumy += cur * y[i];
		}
	}
	long long cur = n * 1LL * (n - 1) * (n - 2) / 3;
	sumx /= cur, sumy /= cur;
	cout << fixed << setprecision(15) << sumx << ' ' << sumy << endl;
	return 0;
}