#include <bits/stdc++.h>
using namespace std;
struct __timestamper {};
struct pt {
  double x, y;
  pt operator-(const pt& a) { return {x - a.x, y - a.y}; }
  double dist() { return sqrt(x * x + y * y); }
};
int main() {
  int n, L;
  while (scanf("%d%d", &n, &L) == 2) {
    vector<pt> p(n);
    vector<double> ang(n);
    vector<int> t(n);
    for (int i = 0; i < n; i++) {
      scanf("%d", &t[i]);
    }
    sort(t.begin(), t.end());
    for (int i = 0; i < n; i++) {
      ang[i] = M_PI * t[i] / L;
      p[i].x = cos(2 * M_PI * t[i] / L);
      p[i].y = sin(2 * M_PI * t[i] / L);
    }
    double ans_x = 0;
    double ans_y = 0;
    for (int i = 0; i < n; i++) {
      double weight = 0;
      double cur = 0;
      vector<double> cur2(n);
      vector<double> t(n);
      for (int j = n - 1; j >= 1; j--) {
        double b = ang[j] - ang[0];
        if (b < 0) b += M_PI;
        b /= 2;
        cur2[j] = cur;
        t[j] = tan(b);
        cur += 1.0 / t[j];
      }
      for (int j = 1; j < n; j++) {
        weight -= t[j] * cur2[j];
      }
      weight += (n - 1) * 1.0 * (n - 2) / 2;
      weight /= n - 2;
      weight /= n - 1;
      ans_x += p[0].x * weight * 3 / n;
      ans_y += p[0].y * weight * 3 / n;
      rotate(p.begin(), p.begin() + 1, p.end());
      rotate(ang.begin(), ang.begin() + 1, ang.end());
    }
    printf("%.18lf %.18lf\n", ans_x, ans_y);
  }
  return 0;
}
