#include <bits/stdc++.h>
using namespace std;
int n, l, a[3010];
double x, y;
int main() {
  scanf("%d %d", &n, &l);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) {
      double arg = M_PI * (a[i] + a[j] + l) / l,
             p = 1.0 * (j - i - 1) / (n - 2);
      x += p * cos(arg);
      y += p * sin(arg);
      arg = M_PI * (a[i] + a[j]) / l, p = 1.0 - p;
      x += p * cos(arg);
      y += p * sin(arg);
    }
  x /= n * (n - 1);
  y /= n * (n - 1);
  x *= 6;
  y *= 6;
  printf("%.15lf %.15lf", x, y);
}
