#include <bits/stdc++.h>
using namespace std;
int N, L, A[9009];
double x[9009], y[9009];
double rx[9009], ry[9009];
double SIN(double I) { return sin(3.141592653589793238 * 2.0 * I); }
long double COS(double I) { return cos(3.141592653589793238 * 2.0 * I); }
int main() {
  cin >> N >> L;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    x[i] = COS(1.0 * A[i] / L);
    y[i] = SIN(1.0 * A[i] / L);
    rx[i + 1] = rx[i] + COS(0.5 * A[i] / L);
    ry[i + 1] = ry[i] + SIN(0.5 * A[i] / L);
  }
  for (int i = N; i < 3 * N; i++) {
    A[i] = A[i - N] + L;
    rx[i + 1] = rx[i] + COS(0.5 * A[i] / L);
    ry[i + 1] = ry[i] + SIN(0.5 * A[i] / L);
  }
  double ex = 0, ey = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (i == j) continue;
      int s1 = j, s2 = i;
      if (j > i) s2 += N;
      if (s2 - s1 == 1) continue;
      double sx = rx[s2] - rx[s1 + 1];
      sx /= (1.0 * (s2 - s1 - 1));
      double sy = ry[s2] - ry[s1 + 1];
      sy /= (1.0 * (s2 - s1 - 1));
      double ave = (A[s1] + A[s2]) / (2.0 * L);
      ave -= 0.50;
      double COS1 = COS(0.25 + ave / 2.0);
      double SIN1 = SIN(0.25 + ave / 2.0);
      double tx = COS1 * sx - SIN1 * sy;
      double ty = SIN1 * sx + COS1 * sy;
      double lx = COS(ave);
      double ly = SIN(ave);
      double vx = tx + lx;
      double vy = ty + ly;
      double bairitsu =
          sqrtl((lx - x[i]) * (lx - x[i]) + (ly - y[i]) * (ly - y[i]));
      double ax = lx + (vx - lx) * bairitsu;
      double ay = ly + (vy - ly) * bairitsu;
      ex += ax * (1.0L * (s2 - s1 - 1));
      ey += ay * (1.0L * (s2 - s1 - 1));
    }
  }
  double Total = 0.5L * N * (1.0L * N - 1.0L) * (1.0L * N - 2.0L);
  printf("%.12lf %.12lf\n", ex / Total, ey / Total);
  return 0;
}
