#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define MRE assert(0);
const int inf = 1e17;
const double pi = 3.14159265358979;
int t[3005];
signed main() {
	int n, l; cin >> n >> l;
	rep(i, n)cin >> t[i];
	double rx = 0, ry = 0;
	rep(i, n) {
		for (int j = i + 1; j < n; j++) {
			int w = t[j] - t[i];
			int p1 = t[i] + t[j], p2 = (p1 + l) % (2 * l);
			if (t[i] <= p2&&p2 <= t[j])swap(p1, p2);
			int k2 = j - i - 1, k1 = n - 2 - k2;
			rx += k1*cos(pi * 2 * p1 / l / 2.0) + k2*cos(pi * 2 * p2 / l / 2.0);
			ry += k1*sin(pi * 2 * p1 / l / 2.0) + k2*sin(pi * 2 * p2 / l / 2.0);
		}
	}
	double d = n*(n - 1)*(n - 2) / 6;
	rx /= d; ry /= d;
	printf("%.13lf %.13lf\n", rx, ry);
}