#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 10;
const long double pi = acosl(-1);
long double X(long double t, long double l) { return cosl((2 * pi * t) / l); }
long double Y(long double t, long double l) { return sinl((2 * pi * t) / l); }
long double midpoint(long double a, long double b, long double l) {
  if (a < b)
    return (a + b) / 2;
  else if (a + b < l)
    return (l + a + b) / 2;
  else
    return (a + b - l) / 2;
}
int main() {
  int n, tot;
  long double x = 0, y = 0, l, t[N], pos;
  cin >> n >> l;
  for (int i = 1; i <= n; i++) cin >> t[i];
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      pos = midpoint(t[i], t[j], l);
      x += X(pos, l) * (n - j + i - 1);
      y += Y(pos, l) * (n - j + i - 1);
      pos = midpoint(t[j], t[i], l);
      x += X(pos, l) * (j - i - 1);
      y += Y(pos, l) * (j - i - 1);
    }
  tot = (((n * (n - 1)) / 2) * (n - 2)) / 3;
  cout << fixed << setprecision(20) << x / tot << ' ' << fixed
       << setprecision(20) << y / tot << endl;
}
