#include <bits/stdc++.h>
using namespace std;
template <typename tp>
inline void read(tp &x) {
  x = 0;
  char c = getchar();
  int f = 0;
  for (; c < '0' || c > '9'; f |= c == '-', c = getchar())
    ;
  for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar())
    ;
  if (f) x = -x;
}
const long double pi = acos(-1.);
const int N = 4444;
int n, L;
long double t[N];
int main(void) {
  read(n);
  read(L);
  for (register int i = 1; i <= (n); i++)
    scanf("%Lf", &t[i]), t[i] = t[i] * 2 * pi / L;
  long double X = 0., Y = 0.;
  for (register int i = 1; i <= (n); i++)
    for (register int j = 1; j <= (i - 1); j++) {
      int in = i - j - 1, out = n - 2 - in;
      long double per = (t[i] + t[j]) / 2.;
      X += cos(per) * (out - in);
      Y += sin(per) * (out - in);
    }
  long double all = n * (n - 1) * (n - 2) / 6;
  printf("%.10Lf %.10Lf\n", X / all, Y / all);
}
