#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  long double L;
  cin >> n >> L;
  vector<int> T(n);
  for (auto &x : T) cin >> x;
  vector<long double> X(n), Y(n);
  for (int i = 0; i < n; ++i) {
    X[i] = cos(2 * 3.14159265358979323846 * T[i] / L);
    Y[i] = sin(2 * 3.14159265358979323846 * T[i] / L);
  }
  long double midX = 0, midY = 0, lenA, lenB, lenC;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      for (int k = j + 1; k < n; ++k) {
        lenA = sqrt(2.0 -
                    2.0 * cos(2 * 3.14159265358979323846 * (T[j] - T[i]) / L));
        lenB = sqrt(2.0 -
                    2.0 * cos(2 * 3.14159265358979323846 * (T[k] - T[i]) / L));
        lenC = sqrt(2.0 -
                    2.0 * cos(2 * 3.14159265358979323846 * (T[k] - T[j]) / L));
        midX +=
            (lenA * X[k] + lenB * X[j] + lenC * X[i]) / (lenA + lenB + lenC);
        midY +=
            (lenA * Y[k] + lenB * Y[j] + lenC * Y[i]) / (lenA + lenB + lenC);
      }
    }
  }
  cout << fixed << setprecision(12);
  cout << midX / (n * (n - 1) * (n - 2) / 6) << " ";
  cout << midY / (n * (n - 1) * (n - 2) / 6) << "\n";
  return 0;
}
