#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int n, L, t[3010];
double x[3010], y[3010];
int main() {
  scanf("%d%d", &n, &L);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &t[i]);
  }
  double ansx = 0, ansy = 0;
  double ang = PI / L;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int mid = ((t[i] + t[j]) + L) % (2 * L);
      double midx = cos(ang * mid), midy = sin(ang * mid);
      ansx += midx * (j - i - 1);
      ansy += midy * (j - i - 1);
      mid = (mid + L) % (2 * L);
      midx = cos(ang * mid), midy = sin(ang * mid);
      ansx += midx * (n - 2 - (j - i - 1));
      ansy += midy * (n - 2 - (j - i - 1));
    }
  }
  printf("%.15lf %.15lf\n", ansx / (1ll * n * (n - 1) * (n - 2)) * 6,
         ansy / (1ll * n * (n - 1) * (n - 2)) * 6);
  return 0;
}
