#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T>
constexpr bool chmax(T &a, const T &b) {
  if (a >= b) return false;
  a = b;
  return true;
}
template <typename T>
constexpr bool chmin(T &a, const T &b) {
  if (a <= b) return false;
  a = b;
  return true;
}
ll n;
double l;
double t[3009];
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cin >> n >> l;
  for (ll i = (ll)0; i < (ll)n; i++) cin >> t[i];
  double res_x = 0, res_y = 0;
  for (ll i = (ll)0; i < (ll)n; i++)
    for (ll j = (ll)0; j < (ll)i; j++) {
      double r = PI * (t[i] + t[j]) / l;
      res_x += cos(r) * (n + j - i - 1);
      res_y += sin(r) * (n + j - i - 1);
      r += PI;
      res_x += cos(r) * (i - j - 1);
      res_y += sin(r) * (i - j - 1);
    }
  ll r = n * (n - 1) * (n - 2) / 6;
  cout << r << endl;
  cout << fixed << setprecision(10);
  cout << res_x / r << " " << res_y / r << endl;
  return 0;
}
