#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3005;
int n, L;
long double t[MAXN], pre[2][2][MAXN][MAXN];
int main() {
  cin >> n >> L;
  for (int i = 1; i <= n; i++) cin >> t[i];
  long double ansx = 0, ansy = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      int cnt = j - i - 1;
      long double tmp = 3.14159265358979323846 * (t[i] + t[j]) / L;
      ansx += cos(tmp) * (n - 2 * cnt - 2),
          ansy += sin(tmp) * (n - 2 * cnt - 2);
    }
  ansx /= n * (n - 1) * (n - 2) / 6;
  ansy /= n * (n - 1) * (n - 2) / 6;
  printf("%.12lf %.12lf\n", (double)ansx, (double)ansy);
  return 0;
}
