#include <bits/stdc++.h>
#define ll long long
#define maxn 1000005 /*rem*/
#define mod 998244353
#define db double
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define pi pair<int, int>
#define fi first
#define se second
using namespace std;
int n, l;
int t[maxn];
const db ppi = acos(-1.0);
int main() {
	cin >> n >> l;
	for (int i = 0; i < n; i++)
		cin >> t[i];
	sort(t, t + n);
	db ax = 0, ay = 0;
	ll fn = 1ll * n * (n - 1) * (n - 2) / 6;
	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++) {
			int ed = 2 * (j - i - 1) - (n - 2);
			db nr = 1.0 * ppi * (t[i] + t[j]) / l;
			ax += cos(nr) * ed, ay += sin(nr) * ed;
		}
	ax /= fn, ay /= fn;
	printf("%.15lf %.15lf\n", -ax, -ay);
	return 0;
}
