#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
long long gcd(long long n, long long m) { return (m ? gcd(m, n % m) : n); }
long long lcm(long long n, long long m) { return n / gcd(n, m) * m; }
int main() {
  int n;
  long double l;
  cin >> n >> l;
  vector<long double> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  complex<long double> ans;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      long double arg1 = (long double)(a[i] + a[j]) / l;
      long double arg2 = (long double)(a[i] + a[j]) / l + 1;
      complex<long double> x(cos(3.141592653589793238 * arg1),
                             sin(3.141592653589793238 * arg1));
      complex<long double> y(cos(3.141592653589793238 * arg2),
                             sin(3.141592653589793238 * arg2));
      x *= (n - 1 + i - j);
      y *= (j - i - 1);
      ans += x;
      ans += y;
    }
  }
  ans *= 6;
  ans /= (n * (n - 1) * (n - 2));
  cout << fixed << setprecision(20);
  cout << ans.real() << ' ' << ans.imag() << endl;
}
