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