#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int n, L, a[2010];
double A, B;
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 x = cos(double(a[i] + a[j]) / L * pi),
             y = sin(double(a[i] + a[j]) / L * pi);
      int k1 = j - i - 1, k2 = n - 2 - k1;
      A += (k2 - k1) * x, B += (k2 - k1) * y;
    }
  A = A / n / (n - 1) / (n - 2) * 6;
  B = B / n / (n - 1) / (n - 2) * 6;
  printf("%.15lf %.15lf", A, B);
  return 0;
}
