#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3009;
long double dist[MAXN][MAXN];
int n, m;
long double x[MAXN];
long double y[MAXN];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    long double t;
    cin >> t;
    long double ang = 2 * acos(-1) * t / m;
    x[i] = cos(ang);
    y[i] = sin(ang);
  }
  for (int i = 0; i < n; i++) {
    for (int e = 0; e < n; e++)
      dist[i][e] =
          sqrt((x[i] - x[e]) * (x[i] - x[e]) + (y[i] - y[e]) * (y[i] - y[e]));
  }
  long double xx = 0;
  long double yy = 0;
  for (int i = 0; i < n; i++) {
    for (int e = i + 1; e < n; e++) {
      for (int j = e + 1; j < n; j++) {
        xx += (x[i] * dist[e][j] + x[e] * dist[i][j] + x[j] * dist[i][e]) /
              (dist[i][e] + dist[i][j] + dist[e][j]);
        yy += (y[i] * dist[e][j] + y[e] * dist[i][j] + y[j] * dist[i][e]) /
              (dist[i][e] + dist[i][j] + dist[e][j]);
      }
    }
  }
  xx /= n * (n - 1) * (n - 2) / 6;
  yy /= n * (n - 1) * (n - 2) / 6;
  cout.precision(20);
  cout << fixed << xx << " " << yy;
}
