#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 5;
const double pi = acos(-1);
int n, L;
double age[N];
int main() {
  scanf("%d%d", &n, &L);
  for (int i = 1; i <= n; i++) {
    scanf("%lf", &age[i]);
    age[i] = 2 * pi * age[i] / L;
  }
  double anx = 0, any = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      double angle = (age[i] + age[j]) / 2;
      anx += cos(angle) * (i - 1 + n - j);
      any += sin(angle) * (i - 1 + n - j);
      angle = -pi + angle;
      anx += cos(angle) * (j - i - 1);
      any += sin(angle) * (j - i - 1);
    }
  double cnt = (double)n * (n - 1) * (n - 2) / 6;
  printf("%.6lf %.6lf\n", anx / cnt, any / cnt);
  return 0;
}
