#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#define int long long
using namespace std;
typedef long double DB;
const int N = 3e3 + 5;
const DB pi = 3.141592653589793238462;
int read() {
	int x = 0, f = 1; char ch;
	while(! isdigit(ch = getchar())) (ch == '-') && (f = -f);
	for(x = ch ^ 48; isdigit(ch = getchar()); x = (x << 3) + (x << 1) + (ch ^ 48));
	return x * f;
}
template <class T> T Max(T a, T b) { return a > b ? a : b; }
template <class T> T Min(T a, T b) { return a < b ? a : b; }
int n, L;
DB ansx, ansy, t[N];
signed main() {
	n = read(); L = read();
	for(int i = 1; i <= n; ++ i) cin >> t[i];
	for(int i = 1; i <= n; ++ i) {
		for(int j = i + 1; j <= n; ++ j) {
			int cnt = j - i - 1;
			DB tmp = pi * (t[i] + t[j]) / L;
			ansx += cos(tmp) * (n - 2 * cnt - 2);
			ansy += sin(tmp) * (n - 2 * cnt - 2);
		}
	}
	ansx = ansx / (n * (n - 1) * (n - 2) / 6);
	ansy = ansy / (n * (n - 1) * (n - 2) / 6);
	printf("%.12Lf %.12Lf\n", ansx, ansy);
	return 0;
}
