#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846264338;
int main() {
  int N, L;
  cin >> N >> L;
  vector<int> T(N);
  for (int i = 0; i < N; i++) {
    cin >> T.at(i);
  }
  double x = 0, y = 0;
  for (int i = 0; i < N - 2; i++) {
    for (int j = i + 1; j < N - 1; j++) {
      x += (N - j - 1) * cos(pi * (T.at(i) + T.at(j)) / L);
      x += (i + 1) * cos(pi * (T.at(i + 1) + T.at(j + 1)) / L);
      x -= (j - i) * cos(pi * (T.at(i) + T.at(j + 1)) / L);
      y += (N - j - 1) * sin(pi * (T.at(i) + T.at(j)) / L);
      y += (i + 1) * sin(pi * (T.at(i + 1) + T.at(j + 1)) / L);
      y -= (j - i) * sin(pi * (T.at(i) + T.at(j + 1)) / L);
    }
  }
  x *= 6.0;
  x /= N * (N - 1) * (N - 2);
  y *= 6.0;
  y /= N * (N - 1) * (N - 2);
  printf("%.18lf %.18lf\n", x, y);
  return 0;
}
