#include <bits/stdc++.h>
const int N = 3e3 + 10;
const double pi = acos(-1);
double X(double t, double l) { return cos((2 * pi * t) / l); }
double Y(double t, double l) { return sin((2 * pi * t) / l); }
double midpoint(double a, double b, double l) {
  if (a < b)
    return (a + b) / 2;
  else if (a + b < l)
    return (l + a + b) / 2;
  else
    return (a + b - l) / 2;
}
int main() {
  int n, tot;
  double x = 0, y = 0, l, t[N], pos;
  scanf("%d%lf", &n, &l);
  for (int i = 1; i <= n; i++) scanf("%lf", &t[i]);
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      pos = midpoint(t[i], t[j], l);
      x += X(pos, l) * (n - j + i - 1);
      y += Y(pos, l) * (n - j + i - 1);
      pos = midpoint(t[j], t[i], l);
      x += X(pos, l) * (j - i - 1);
      y += Y(pos, l) * (j - i - 1);
    }
  tot = (((n * (n - 1)) / 2) * (n - 2)) / 3;
  printf("%.20lf %.20lf\n", x / tot, y / tot);
}
