#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int n;
int l;
pair<double, double> twoT2P(int twoT) {
  double v = pi * twoT / l;
  return make_pair(cos(v), sin(v));
}
int t[3010];
int main() {
  cin >> n >> l;
  for (int i = 0; i < n; i++) {
    scanf("%d", t + i);
  }
  double cntX = 0;
  double cntY = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      {
        auto [px, py] = twoT2P(t[i] + t[j]);
        cntX += (n - (j - i + 1)) * px;
        cntY += (n - (j - i + 1)) * py;
      }
      {
        auto [px, py] = twoT2P(t[i] + t[j] + l);
        cntX += ((j - i - 1)) * px;
        cntY += ((j - i - 1)) * py;
      }
    }
  }
  printf("%.15lf %.15lf\n", 6 * cntX / n / (n - 1) / (n - 2),
         6 * cntY / n / (n - 1) / (n - 2));
  return 0;
}
