#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005;
const long double pi = acos(-1.0);
int n, L, a[maxn];
long long w;
long double x, y, X, Y;
int main() {
  cin >> n >> L;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      x = cos(pi * (a[i] + a[j]) / L);
      y = sin(pi * (a[i] + a[j]) / L);
      int r = ((n - 2) - (j - i - 1)) - (j - i - 1);
      X += x * r;
      Y += y * r;
    }
  w = 1ll * n * (n - 1) * (n - 2) / 6;
  printf("%.15Lf %.15Lf\n", X / w, Y / w);
  return 0;
}
