#include <bits/stdc++.h>

#define itn int
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}

const long double pi = acosl(-1);

int main() {
	int n = nxt(), L = nxt();
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		a[i] = nxt();
	}

	long long total = 1ll * n * (n - 1) * (n - 2) / 6;
	long double ix = 0, iy = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			long double x = cosl(pi * (a[i] + a[j]) / L);
			long double y = sinl(pi * (a[i] + a[j]) / L);
			int c = i - (j - i - 1) + (n - j - 1);
			ix += x * c / total;
			iy += y * c / total;
		}
	}

	cout << setprecision(12) << fixed;
	cout << ix << " " << iy << "\n";

	return 0;
}
