#include <bits/stdc++.h>
int main() {
  int i, N, L, T[3001];
  scanf("%d %d", &N, &L);
  for (i = 1; i <= N; i++) scanf("%d", &(T[i]));
  int j;
  long double t[3001], x = 0.0, y = 0.0;
  for (i = 1; i <= N; i++) t[i] = (long double)T[i] / L * 3.14159265359 * 2.0;
  for (i = 1; i <= N - 1; i++) {
    for (j = i + 1; j <= N; j++) {
      x += cos((t[i] + t[j]) / 2) * (N - (j - i) * 2);
      y += sin((t[i] + t[j]) / 2) * (N - (j - i) * 2);
    }
  }
  printf("%.15Lf %.15Lf\n", x * 6 / (N * (N - 1) * (N - 2)),
         y * 6 / (N * (N - 1) * (N - 2)));
  fflush(stdout);
  return 0;
}
