#include <bits/stdc++.h>
using namespace std;
const int N = 3300;
const double pi = acos(-1.0);
int n, a[N], L, C;
double X, Y;
int main() {
  scanf("%d%d", &n, &L), L <<= 1, C = 1ll * n * (n - 1) * (n - 2) / 6;
  for (int i = 0; i < n; i++) scanf("%d", a + i), a[i] <<= 1;
  sort(a, a + n);
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      X += (n + i - j - 1) * cos(2 * pi * (a[i] + a[j] >> 1) / L) +
           (j - i - 1) * cos(2 * pi * (a[i] + a[j] + L >> 1) / L);
      Y += (n + i - j - 1) * sin(2 * pi * (a[i] + a[j] >> 1) / L) +
           (j - i - 1) * sin(2 * pi * (a[i] + a[j] + L >> 1) / L);
    }
  printf("%.15lf %.15lf\n", X / C, Y / C);
}
