#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ch = char;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ld PI = acos(-1);
const ll INF = 1e18;
struct edge {
  ll to, cost;
};
struct edge2 {
  ll from, to, cost;
};
template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, L;
  cin >> N >> L;
  vector<ld> T(N);
  for (int i = 0; i < N; i++) {
    cin >> T[i];
  }
  ld resx = 0, resy = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < i; j++) {
      resx += (N - 2 + 2 * (j - i + 1)) * cos((PI * (T[i] + T[j]) / L));
      resy += (N - 2 + 2 * (j - i + 1)) * sin(PI * (T[i] + T[j]) / L);
    }
  }
  cout << resx << ' ' << resy << endl;
  cout << fixed << setprecision(10) << resx * 6 / (N * (N - 1) * (N - 2)) << ' '
       << resy * 6 / (N * (N - 1) * (N - 2)) << endl;
}
