#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;
using LD = long double;
const LD PI = acos(-1);
void Main() {
  int n, l;
  cin >> n >> l;
  vi t(n);
  for (int(i) = 0; (i) < (n); (i)++) cin >> t[i];
  LD ansx = 0;
  LD ansy = 0;
  for (int(i) = 0; (i) < (n - 1); (i)++) {
    for (int(j) = i + 1; (j) <= (n - 1); (j)++) {
      LD mid = LD(t[i] + t[j]) / l;
      LD mid2 = mid + 1;
      if (mid2 >= 2) mid2 -= 2;
      int cnt = j - i - 1;
      int cnt2 = n - 2 - cnt;
      ansx += cos(mid * PI) * cnt2 + cos(mid2 * PI) * cnt;
      ansy += sin(mid * PI) * cnt2 + sin(mid2 * PI) * cnt;
    }
  }
  ll tot = n * (n - 1) * (n - 2) / 6;
  cout << ansx / tot << " " << ansy / tot << endl;
  return;
}
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}
