#include <bits/stdc++.h>
const int N = 3003;
const long double pi = acos(-1);
using namespace std;
int n, m, a[N];
long double x, y;
inline void pls(int d, int v) {
  x += v * cos(pi * d / m), y += v * sin(pi * d / m);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    for (int j = 0; j < i; j++)
      pls(a[i] + a[j], j + n - i - 1), pls(a[i] + a[j] + m, i - j - 1);
  }
  printf("%.10Lf %.10Lf", x * 6 / n / (n - 1) / (n - 2),
         y * 6 / n / (n - 1) / (n - 2));
}
