#include <bits/stdc++.h>
using namespace std;
const int N = 3007;
const int INF = 1e9 + 7;
const long double PI = 3.14159265358979;
int n, L;
int a[N];
long double X = 0, Y = 0;
int main() {
  scanf("%d%d", &n, &L);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      X += (j - i - 1) * cos((a[i] + a[j] + L) * PI / L);
      X += (n - j + i - 1) * cos((a[i] + a[j]) * PI / L);
      Y += (j - i - 1) * sin((a[i] + a[j] + L) * PI / L);
      Y += (n - j + i - 1) * sin((a[i] + a[j]) * PI / L);
    }
  }
  printf("%.10LF %.10LF\n", 6 * X / n / (n - 1) / (n - 2),
         6 * Y / n / (n - 1) / (n - 2));
  return 0;
}
