#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
  out << "(" << p.first << "," << p.second << ")";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  for (auto a : v) out << a << " ";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
  for (auto a : S) cout << a << " ";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
  for (auto a : S) cout << a << " ";
  return out;
}
template <typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
  for (auto m : M) cout << "(" << m.first << "->" << m.second << ") ";
  return out;
}
template <typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
  return make_pair(a.first + b.first, a.second + b.second);
}
template <typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
  return make_pair(a.first - b.first, a.second - b.second);
}
using point = complex<long double>;
point query_point(int L, int k) {
  return polar<long double>(1.0, 2 * acos(-1.0L) / L * k);
}
point solve(int L, vector<int>& A) {
  int n = A.size();
  point ans(0.0, 0.0);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int k1 = (A[i] + A[j]) / 2;
      int k2 = (k1 + L / 2) % L;
      point p1 = query_point(L, k1);
      point p2 = query_point(L, k2);
      int cnt1 = i + n - j - 1;
      int cnt2 = n - 2 - cnt1;
      ans =
          (ans + p1 * polar<long double>(cnt1) + p2 * polar<long double>(cnt2));
    }
  }
  ans = ans * polar<long double>(6);
  ans = ans / polar<long double>(n);
  ans = ans / polar<long double>(n - 1);
  ans = ans / polar<long double>(n - 2);
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, L;
  vector<int> A;
  cin >> n >> L;
  L <<= 1;
  A.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    A[i] <<= 1;
  }
  point ans = solve(L, A);
  cout << fixed << setprecision(15) << ans.real() << " " << ans.imag() << endl;
  return 0;
}
