#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> P) {
  out << '(' << P.first << ',' << P.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> V) {
  for (int i = 0; i < ((int)((int)V.size())); i++)
    out << V[i] << ((i != ((int)V.size()) - 1) ? " " : "");
  return out;
}
const long long maxn = 300005;
const long long maxlg = 20;
const long long INF64 = 1e18;
const int INF = 0x3f3f3f3f;
const long long MOD = long long(1e9 + 7);
const long double PI = acos(-1);
const long double eps = 1e-9;
long long mypow(long long a, long long b) {
  long long res = 1LL;
  while (b) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return res;
}
int n;
long long L;
long long a[maxn];
long double prex[maxn], prey[maxn];
long double q(int l, int r, long double* pre) {
  if (l < r)
    return pre[r] - pre[l];
  else
    return pre[r] - (pre[n] - pre[l]);
}
pair<long double, long double> query(int l, int r) {
  return make_pair(q(l, r, prex), q(l, r, prey));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> L;
  for (int i = 0; i < ((int)n); i++) cin >> a[i];
  prex[0] = prey[0];
  for (int i = 1; i <= n; i++) {
    prex[i] = prex[i - 1] + cos(PI * a[i - 1] / L);
    prey[i] = prey[i - 1] + sin(PI * a[i - 1] / L);
  }
  pair<long double, long double> ans = make_pair(0, 0);
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      if (j == (i + 1) % n) continue;
      pair<long double, long double> upp = query((i + 1) % n, j);
      pair<long double, long double> O =
          make_pair(cos((a[i] + a[j]) * PI / L), sin((a[i] + a[j]) * PI / L));
      if (a[i] < a[j]) {
        O.first = -O.first;
        O.second = -O.second;
      }
      long double R = hypot(O.first - cos(2 * PI * a[i] / L),
                            O.second - sin(2 * PI * a[i] / L));
      long double len = (long double)(a[j] - a[i]);
      if (a[i] > a[j]) len += L;
      long double theta = (a[i] - (L - len) / 4) / L * (2 * PI) + PI / 2;
      if (a[i] < a[j])
        theta -= PI * a[i] / L;
      else
        theta -= (PI * a[i] / L + PI);
      pair<long double, long double> rot =
          make_pair(upp.first * cos(theta) - upp.second * sin(theta),
                    upp.first * sin(theta) + upp.second * cos(theta));
      rot.first *= R;
      rot.second *= R;
      rot.first += O.first * (j - i - 1);
      rot.second += O.second * (j - i - 1);
      ans.first += rot.first;
      ans.second += rot.second;
    }
  ans.first /= (n * (n - 1) * (n - 2)) / 6;
  ans.second /= (n * (n - 1) * (n - 2)) / 6;
  cout << fixed << setprecision(12) << ans.first << ' ' << ans.second << '\n';
  return 0;
}
