#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, L;
  cin >> N >> L;
  long long int a[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  long long int c = N * (N - 1) * (N - 2) / 6;
  long double x = 0;
  long double y = 0;
  long double pi = 3.14159265358979323846264338327950288;
  for (int j = 0; j < N - 1; j++) {
    for (int k = j + 1; k < N; k++) {
      x = x + (N - 2 * (k - j)) * cos(pi * (a[j] + a[k]) / L) / c;
      y = y + (N - 2 * (k - j)) * sin(pi * (a[j] + a[k]) / L) / c;
    }
  }
  cout << x << " " << y << endl;
}
