#include <bits/stdc++.h>
const double pi = asin(1.) * 2;
int main() {
  int n;
  long long L;
  scanf("%d%lld", &n, &L);
  double T[3010];
  for (int i = 0; i < n; i++) {
    scanf("%lf", T + i);
    T[i] *= 2 * pi / L;
  }
  double ansx = 0, ansy = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      double m0 = (T[i] + T[j]) / 2, m1 = m0 + pi;
      ansx += cos(m0) * (n - (j - i) - 1) + cos(m1) * (j - i - 1);
      ansy += sin(m0) * (n - (j - i) - 1) + sin(m1) * (j - i - 1);
    }
  }
  ansx /= n * (n - 1) * (n - 2) / 6;
  ansy /= n * (n - 1) * (n - 2) / 6;
  printf("%.10lf %.10lf\n", ansx, ansy);
  return 0;
}
