#include <bits/stdc++.h>
using namespace std;
const int N = 3005;
const double PI = acos(-1);
int n, L, T[N];
int main() {
  scanf("%d%d", &n, &L);
  for (int i = 1; i <= n; ++i) scanf("%d", T + i);
  double sx = 0, sy = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) {
      double arg = (T[i] + T[j]) * PI / L;
      sx += cos(arg) * (n - j + i - 1), sy += sin(arg) * (n - j + i - 1);
      arg = T[j] * 2 * PI / L + (T[i] + L - T[j]) * PI / L;
      sx += cos(arg) * (j - i - 1), sy += sin(arg) * (j - i - 1);
    }
  sx /= n * (n - 1) * (n - 2) / 6;
  sy /= n * (n - 1) * (n - 2) / 6;
  printf("%.15lf %.15lf\n", sx, sy);
  return 0;
}
