#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  double L;
  cin >> N >> L;
  vector<double> T(N);
  for (double &t : T) cin >> t;
  double pi = acos(-1.0);
  double ax = 0.0;
  double ay = 0.0;
  int n = N * (N - 1) * (N - 2) / 6;
  for (int i = 0; i < N; i++)
    for (int j = i + 1; j < N; j++) {
      double t = (T[j] + T[i]) / 2 / L * (2 * pi);
      ax += (N - (j - i) - 1) * cos(t) / n;
      ay += (N - (j - i) - 1) * sin(t) / n;
      ax += (j - i - 1) * cos(t + pi) / n;
      ay += (j - i - 1) * sin(t + pi) / n;
    }
  printf("%.10f %.10f\n", ax, ay);
}
