#include <bits/stdc++.h>
using namespace std;
int n, m, a[3010];
const double PI = acos(-1.0);
double xa, ya;
int sum;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n - 1; i++)
    for (int j = i + 1; j <= n; j++) {
      xa += cos(PI * (a[i] + a[j]) / m) * (n - j - j + i + i);
      ya += sin(PI * (a[i] + a[j]) / m) * (n - j - j + i + i);
      sum += (n - j);
    }
  printf("%.10f %.10f", xa / sum, ya / sum);
  return 0;
}
