#include <bits/stdc++.h>
using namespace std;
const double Pi = acos(-1.0);
int n, l, t[5005];
int main() {
  scanf("%d%d", &n, &l);
  for (int i = 1; i <= n; i++) scanf("%d", &t[i]);
  double x = 0, y = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      x += cos(Pi * (t[j] + t[i]) / l) * (n - (j - i + 1)) +
           cos(Pi * (t[j] + t[i] + l) / l) * (j - i - 1);
      y += sin(Pi * (t[j] + t[i]) / l) * (n - (j - i + 1)) +
           sin(Pi * (t[j] + t[i] + l) / l) * (j - i - 1);
    }
  x /= n * (n - 1.0) * (n - 2) / 6;
  y /= n * (n - 1.0) * (n - 2) / 6;
  printf("%.12lf %.12lf\n", x, y);
  return 0;
}
