#include <bits/stdc++.h>
using namespace std;
const long double PI = 4 * atan(1);
long long N, L;
vector<long long> T;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> L;
  L *= 2;
  T.resize(N);
  for (int i = 0; i < N; i++) cin >> T[i], T[i] *= 2;
  sort(T.begin(), T.end());
  long double x = 0;
  long double y = 0;
  map<long long, long long> weight;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      long long a1 = T[i], a2 = T[j];
      long long m1 = (a1 + a2) / 2, m2 = (m1 + L / 2) % L;
      long long n1 = N - (j - i - 1 + 2), n2 = j - i - 1;
      long long sub = min(n1, n2);
      n1 -= sub, n2 -= sub;
      weight[m1] += n1, weight[m2] += n2;
    }
  }
  for (auto pt : weight) {
    long long a = pt.first;
    long long w = pt.second;
    if (w == 0) continue;
    long double arg = 2 * PI * a / L;
    x += (cos(arg) * w), y += (sin(arg) * w);
  }
  long long tot = N * (N - 1) * (N - 2) / 6;
  x /= tot;
  y /= tot;
  cout << fixed << setprecision(100);
  cout << x << " " << y << '\n';
  return 0;
}
