#include <bits/stdc++.h>
using namespace std;
template <class T>
void debug(T itr1, T itr2) {
  auto now = itr1;
  while (now < itr2) {
    cout << *now << " ";
    now++;
  }
  cout << endl;
}
const long long MOD = pow(10, 9) + 7;
const long long LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;
int main() {
  int N;
  cin >> N;
  double L;
  cin >> L;
  double T[(int)L];
  for (int i = (int)0; i < (int)N; i++) cin >> T[i];
  double rx = 0, ry = 0;
  for (int i = (int)0; i < (int)N; i++)
    for (int j = (int)i + 1; j < (int)N; j++) {
      double theta1 = ((double)(T[i] + T[j]) / 2) * M_PI * 2 / L;
      double theta2 = (theta1 < M_PI) ? theta1 + M_PI : theta1 - M_PI;
      rx += cos(theta1) * ((N + i) - j - 1) + cos(theta2) * (j - i - 1);
      ry += sin(theta1) * ((N + i) - j - 1) + sin(theta2) * (j - i - 1);
    }
  rx /= N * (N - 1) * (N - 2) / 6;
  ry /= N * (N - 1) * (N - 2) / 6;
  cout << fixed << setprecision(10) << rx << " " << ry << endl;
  return 0;
}
