#include <bits/stdc++.h>
using namespace std;
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v) is >> x;
  return is;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i) os << ' ' << v[i];
  }
  return os;
}
const double PI = acos(-1.);
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, l;
  cin >> n >> l;
  vector<int> t(n);
  cin >> t;
  vector<double> theta(n);
  transform(t.begin(), t.end(), theta.begin(),
            [&](int t) { return 2 * PI * t / l; });
  function<complex<double>(double)> unit = [](double theta) {
    return complex<double>(cos(theta), sin(theta));
  };
  complex<double> ans = 0;
  complex<double> sum = 0;
  for (int i = 1; i < n - 1; ++i) {
    sum += unit(theta[i - 1] * .5);
    for (int j = i + 1; j < n; ++j) {
      complex<double> center = unit((theta[i] + theta[j]) * .5);
      double r = sin((theta[j] - theta[i]) * .25) * 2;
      complex<double> relative =
          sum * unit((theta[i] + theta[j]) * .25 - PI * .5);
      ans += center * (double)i + r * relative;
    }
  }
  ans /= n * (n - 1) * (n - 2) / 6;
  printf("%.15f %.15f\n", ans.real(), ans.imag());
  return 0;
}
