#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
long N, L, T[3000];
int main() {
  cin >> N >> L;
  for (int i = 0; i < N; ++i) {
    cin >> T[i];
  }
  double x = 0;
  double y = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      if (i == j) continue;
      int a = T[i];
      int b = T[j];
      if (b < a) b += L;
      double rad = PI * (a + b) / L;
      int cont = i - j - 1;
      if (cont < 0) cont += N;
      x += cont * cos(rad);
      y += cont * sin(rad);
    }
  }
  x /= N * (N - 1) * (N - 2) / 6;
  y /= N * (N - 1) * (N - 2) / 6;
  cout << fixed << setprecision(16) << x << ' ' << y << endl;
}
