#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3010;
const long double pi = acosl(-1);
int num[MAXN], n, l, sum;
long double sum1, sum2;
int main() {
  scanf("%d%d", &n, &l);
  for (register int i = 1; i <= n; i++) scanf("%d", &num[i]);
  for (register int i = 1; i <= n; i++)
    for (register int j = i + 1; j <= n; j++)
      sum1 += (n - ((j - i) << 1)) * cosl(pi * (num[i] + num[j]) / l),
          sum2 += (n - ((j - i) << 1)) * sinl(pi * (num[i] + num[j]) / l);
  sum = n * (n - 1) * (n - 2) / 6;
  printf("%.18Lf %.18Lf\n", (long double)(sum1 / sum),
         (long double)(sum2 / sum));
  return 0;
}
