#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
int n, L, sl, fh, t[1000010];
double d, ansx, ansy;
int rd() {
  sl = 0;
  fh = 1;
  char ch = getchar();
  while (ch < '0' || '9' < ch) {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') sl = sl * 10 + ch - '0', ch = getchar();
  return sl * fh;
}
int main() {
  n = rd();
  L = rd();
  for (int i = 1; i <= n; ++i) t[i] = rd();
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) {
      d = (t[i] + t[j]) / L / 2;
      ansx += cos(2 * PI * d) * (i - 1 + n - j) +
              cos(2 * PI * d + PI) * (j - i - 1);
      ansy += sin(2 * PI * d) * (i - 1 + n - j) +
              sin(2 * PI * d + PI) * (j - i - 1);
    }
  printf("%.10lf %.10lf\n", ansx * 6 / n / (n - 1) / (n - 2),
         ansy * 6 / n / (n - 1) / (n - 2));
  return 0;
}
