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

const int N = 3005;

int n, L;
int a[N];

int main() {
	scanf("%d%d", &n, &L);
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
	}
	long double pi = acos(-1);
	long double Ex = 0, Ey = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			int cnt1 = j - i - 1, cnt2 = n - 2 - cnt1;
			long double theta = ((a[i] + a[j]) * pi / L);
			Ex += cos(theta) * (cnt2 - cnt1);
			Ey += sin(theta) * (cnt2 - cnt1);
		}
	}
	long long cnt = 1ll * n * (n - 1) * (n - 2) / 6;
	Ex /= cnt, Ey /= cnt;
	printf("%.12lf %.12lf\n", (double) Ex, (double) Ey);
	return 0;
}
