#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
const long long int mod = 998244353;
const long long int big = 2.19e15 + 1;
const long double pai = 3.141592653589793238462643383279502884197;
const long double eps = 1e-12;
template <class T, class U>
bool mineq(T& a, U b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T, class U>
bool maxeq(T& a, U b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
long long int gcd(long long int a, long long int b) {
  if (a % b == 0) {
    return b;
  } else
    return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  if (a == 0) {
    return b;
  }
  return a / gcd(a, b) * b;
}
template <class T>
void SO(T& ve) {
  sort(ve.begin(), ve.end());
}
template <class T>
void REV(T& ve) {
  reverse(ve.begin(), ve.end());
}
template <class T>
long long int LBI(const vector<T>& ar, T in) {
  return lower_bound(ar.begin(), ar.end(), in) - ar.begin();
}
template <class T>
long long int UBI(const vector<T>& ar, T in) {
  return upper_bound(ar.begin(), ar.end(), in) - ar.begin();
}
int main(void) {
  cout << fixed << setprecision(20);
  cin.tie(0);
  ios::sync_with_stdio(false);
  int i, j, n, L;
  cin >> n >> L;
  vector<double> xza(n);
  vector<double> yza(n);
  vector<double> hxza(n);
  vector<double> hyza(n);
  double xans = 0, yans = 0;
  vector<int> T(n);
  for (i = 0; i < n; i++) {
    cin >> T[i];
    xza[i] = cos(pai * 2 * T[i] / L);
    yza[i] = sin(pai * 2 * T[i] / L);
    hxza[i] = cos(pai * T[i] / L);
    hyza[i] = sin(pai * T[i] / L);
  }
  vector<double> xwa(n);
  vector<double> ywa(n);
  for (i = n - 1; i > 0; i--) {
    xwa[i - 1] = xwa[i] + cos(pai + pai * T[i] / L);
    ywa[i - 1] = ywa[i] + sin(pai + pai * T[i] / L);
  }
  for (i = 0; i < n - 2; i++) {
    for (j = i + 1; j < n - 1; j++) {
      double xa = cos(pai * (T[i] + T[j]) / L);
      double ya = sin(pai * (T[i] + T[j]) / L);
      double xg = xwa[j] * (xza[i] - xa) - ywa[j] * (yza[i] - ya);
      double yg = ywa[j] * (xza[i] - xa) + xwa[j] * (yza[i] - ya);
      xans += xg * hxza[i] + yg * hyza[i] + xa * (n - j - 1);
      yans += yg * hxza[i] - xg * hyza[i] + ya * (n - j - 1);
    }
  }
  xans /= n * (n - 1) * (n - 2);
  xans *= 6;
  yans /= n * (n - 1) * (n - 2);
  yans *= 6;
  cout << xans << " " << yans << endl;
  return 0;
}
