#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 3000;
const double MPI = acos(-1.0);
struct P {
  double x, y;
  P() {}
  P(double x, double y) : x(x), y(y) {}
};
int n, den;
int num[MAXN];
double ang[MAXN - 1];
P solve() {
  P ret(0, 0);
  for (int i = (0); i < (n); ++i) {
    P cur(cos(2 * MPI * num[i] / den), sin(2 * MPI * num[i] / den));
    for (int j = (0); j < (n - 1); ++j)
      ang[j] = 2 * MPI * ((num[(i + 1 + j) % n] + den - num[i]) % den) / den;
    double mlt = 0, sum = 0;
    for (int j = (0); j < (n - 1); ++j) {
      mlt += 0.5 * (j - tan((2 * MPI - ang[j]) / 4) * sum);
      sum += tan(ang[j] / 4);
    }
    ret.x += mlt * cur.x, ret.y += mlt * cur.y;
  }
  long long cnt = (long long)n * (n - 1) * (n - 2) / 6;
  ret.x /= cnt, ret.y /= cnt;
  return ret;
}
void run() {
  scanf("%d%d", &n, &den);
  for (int i = (0); i < (n); ++i) scanf("%d", &num[i]);
  P ans = solve();
  printf("%.15lf %.15lf\n", ans.x, ans.y);
}
int main() {
  run();
  return 0;
}
