#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
const double pi = acos(-1);
int n, L;
int t[maxn];
int main() {
  scanf("%d%d", &n, &L);
  for (int i = 1; i <= n; i++) scanf("%d", &t[i]);
  double ansx = 0, ansy = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (i != j) {
        double ang;
        int cnt;
        if (j > i) {
          cnt = j - i + 1;
          ang = double(t[i] + t[j]) * pi / double(L);
        } else {
          cnt = j - i + 1 + n;
          ang = double(t[i] + t[j] + L) * pi / double(L);
        }
        ansx += cos(ang) * (n - cnt);
        ansy += sin(ang) * (n - cnt);
      }
  printf("%.15lf %.15lf\n", ansx * 6 / double(1LL * n * (n - 1) * (n - 2)),
         ansy * 6 / double(1LL * n * (n - 1) * (n - 2)));
  return 0;
}
