#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') f = -1;
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 1) + (x << 3) + ch - '0';
  return x * f;
}
const double pi = acos(-1.0);
const int N = 3e3 + 5;
double t[N];
int main() {
  int n = read();
  int L = read();
  for (int i = 1; i <= n; ++i) t[i] = read();
  double ansx = 0.0;
  double ansy = 0.0;
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) {
      double ang = 1.0 * (t[i] + t[j]) * pi / L;
      double x = cos(ang);
      double y = sin(ang);
      ansx += x * (n - 2 * (j - i));
      ansy += y * (n - 2 * (j - i));
    }
  n = 1LL * n * (n - 1) * (n - 2) / 6;
  printf("%.10f %.10f\n", ansx / n, ansy / n);
  return 0;
}
