#include <bits/stdc++.h>
using namespace std;
int n, l, v[3050];
long double pi = acos(-1), su[3050][2], as1, as2;
int main() {
  scanf("%d%d", &n, &l);
  l *= 2;
  for (int i = 1; i <= n; i++)
    scanf("%d", &v[i]), v[i] *= 2, su[i][0] = su[i - 1][0] + cos(pi * v[i] / l),
                                   su[i][1] = su[i - 1][1] + sin(pi * v[i] / l);
  for (int i = 1; i <= n; i++)
    for (int j = i + 2; j <= n; j++) {
      long long su1 = 1ll * v[i] + v[j];
      if (su1 < l) {
        int st = l - (l - su1) / 2;
        long double c1 = cos(pi * st / l + 1.5 * pi),
                    c2 = sin(pi * st / l + 1.5 * pi);
        long double v1 = c1 * (su[j - 1][0] - su[i][0]) -
                         c2 * (su[j - 1][1] - su[i][1]),
                    v2 = c2 * (su[j - 1][0] - su[i][0]) +
                         c1 * (su[j - 1][1] - su[i][1]);
        long double st1 = cos(v[i] * 2 * pi / l) - cos(st * 2 * pi / l),
                    st2 = sin(v[i] * 2 * pi / l) - sin(st * 2 * pi / l);
        long double le1 = sqrt(st1 * st1 + st2 * st2);
        v1 *= le1, v2 *= le1;
        v1 += cos(st * 2 * pi / l) * (j - i - 1),
            v2 += sin(st * 2 * pi / l) * (j - i - 1);
        as1 += v1, as2 += v2;
      } else {
        int st = (su1 - l) / 2;
        long double c1 = cos(pi * st / l + 0.5 * pi),
                    c2 = sin(pi * st / l + 0.5 * pi);
        long double v1 = c1 * (su[j - 1][0] - su[i][0]) -
                         c2 * (su[j - 1][1] - su[i][1]),
                    v2 = c2 * (su[j - 1][0] - su[i][0]) +
                         c1 * (su[j - 1][1] - su[i][1]);
        long double st1 = cos(v[i] * 2 * pi / l) - cos(st * 2 * pi / l),
                    st2 = sin(v[i] * 2 * pi / l) - sin(st * 2 * pi / l);
        long double le1 = sqrt(st1 * st1 + st2 * st2);
        v1 *= le1, v2 *= le1;
        v1 += cos(st * 2 * pi / l) * (j - i - 1),
            v2 += sin(st * 2 * pi / l) * (j - i - 1);
        as1 += v1, as2 += v2;
      }
    }
  long double st1 = 1.0 * n * (n - 1) * (n - 2) / 6;
  as1 /= st1, as2 /= st1;
  printf("%.15Lf %.15Lf\n", as1, as2);
}
