#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/range/algorithm.hpp>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
#define PI 3.14159265358979

int main() {
  int n, l;
  cin >> n >> l;
  vector<int> t(n);
  rep(i, n) { cin >> t[i]; }
  double ansx = 0;
  double ansy = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      ansx += -cos(2 * PI * (t[i] + t[j]) / 2.0 / l) * (j - i - 1);
      ansy += -sin(2 * PI * (t[i] + t[j]) / 2.0 / l) * (j - i - 1);
      ansx += cos(2 * PI * (t[i] + t[j]) / 2.0 / l) * ((n - 2) - (j - i - 1));
      ansy += sin(2 * PI * (t[i] + t[j]) / 2.0 / l) * ((n - 2) - (j - i - 1));
    }
  }

  ansx /= n * (n - 1) * (n - 2) / 6;
  ansy /= n * (n - 1) * (n - 2) / 6;
  cout << setprecision(15) << ansx << " " << ansy << endl;
  return 0;
}