#include <bits/stdc++.h>
using namespace std;
const int N = 3005;
int n, L;
int a[N];
int main() {
  scanf("%d%d", &n, &L);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
  }
  long double pi = acos(-1);
  long double ang = pi * 2 / L;
  long double Ex = 0, Ey = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int cnt1 = j - i - 1, cnt2 = n - 2 - cnt1;
      long double theta = ang * ((a[i] + a[j]) * 0.5);
      Ex += cos(theta) * (cnt2 - cnt1);
      Ey += sin(theta) * (cnt2 - cnt1);
    }
  }
  long long cnt = n * (n - 1) * (n - 2) / 6;
  Ex /= cnt, Ey /= cnt;
  printf("%.9lf %.9lf\n", (double)Ex, (double)Ey);
  return 0;
}
