#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

template<typename T>
vector<T> gen_v(size_t a) { return vector<T>(a); }
template<typename T, typename ...Ts>
auto gen_v(size_t a, Ts... ts) { return vector<decltype(gen_v<T>(ts...))>(a, gen_v<T>(ts...)); }
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }

//#define double long double
const double PI = acos(-1);

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	int N; cin >> N;
	int L; cin >> L;
	vector<int> T(N); rep(i, 0, N) {
		cin >> T[i];
	}
	double ansx = 0, ansy = 0;
	rep(i, 0, N)rep(j, i + 1, N) {
		double x = 2 * PI / L * (T[i] + T[j]) / 2.;
		double y = x + PI;
		int c1 = N + i - j - 1;
		int c2 = j - i - 1;
		ansx += cos(x) * c1;
		ansx += cos(y) * c2;
		ansy += sin(x) * c1;
		ansy += sin(y) * c2;
	}
	ansx /= N * (N - 1) * (N - 2) / 3 / 2;
	ansy /= N * (N - 1) * (N - 2) / 3 / 2;
	cout << ansx << " " << ansy << endl;
	return 0;
}