#include <bits/stdc++.h>
using namespace std;
const long double Pi = acos(-1);
int n, l;
int t[3005];
long double ansx, ansy;
int main() {
  scanf("%d%d", &n, &l);
  l *= 2;
  for (int i = 1; i <= n; i++) scanf("%d", &t[i]), t[i] *= 2;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int s1 = (t[i] + t[j]) / 2, s2;
      if (s1 > l / 2)
        s2 = s1 - (l / 2);
      else
        s2 = s1 + (l / 2);
      ansx += cos(2 * Pi * s1 / l) * (n - (j - i + 1));
      ansy += sin(2 * Pi * s1 / l) * (n - (j - i + 1));
      ansx += cos(2 * Pi * s2 / l) * (j - i - 1);
      ansy += sin(2 * Pi * s2 / l) * (j - i - 1);
    }
  }
  ansx /= n, ansy /= n;
  ansx /= n - 1, ansy /= n - 1;
  ansx /= n - 2, ansy /= n - 2;
  ansx *= 6, ansy *= 6;
  printf("%.15lf %.15lf\n", double(ansx), double(ansy));
}
