#include <bits/stdc++.h>
using namespace std;
template <typename TYPE>
inline void chkmax(TYPE &first, TYPE second) {
  first < second ? first = second : 0;
}
template <typename TYPE>
inline void chkmin(TYPE &first, TYPE second) {
  second < first ? first = second : 0;
}
template <typename TYPE>
void readint(TYPE &first) {
  first = 0;
  int f = 1;
  char c;
  for (c = getchar(); !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) first = first * 10 + c - '0';
  first *= f;
}
const int MAXN = 3005;
const double pi = acos(-1);
int n, L;
double a[MAXN];
int main() {
  readint(n);
  readint(L);
  for (register int i = (1); i <= (n); ++i) {
    scanf("%lf", &a[i]);
    a[i] = 2 * pi * a[i] / L;
  }
  sort(a + 1, a + n + 1);
  double first = 0, second = 0;
  for (register int i = (1); i <= (n); ++i)
    for (register int j = (i + 1); j <= (n); ++j) {
      double b = (a[i] + a[j]) / 2;
      first += ((n - j + i - 1) - (j - i - 1)) * cos(b);
      second += ((n - j + i - 1) - (j - i - 1)) * sin(b);
    }
  printf("%.10lf %.10lf\n", first * 6 / (n * (n - 1) * (n - 2)),
         second * 6 / (n * (n - 1) * (n - 2)));
  return 0;
}
