#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 ratio = N * (N - 1) * (N - 2) / 6.0;
  double x = 0, y = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      x += (N - 2 * j + 2 * i) * cos(pi * (T.at(i) + T.at(j)) / L) / ratio;
      y += (N - 2 * j + 2 * i) * sin(pi * (T.at(i) + T.at(j)) / L) / ratio;
    }
  }
  printf("%.15lf %.15lf\n", x, y);
  return 0;
}
