#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 998244353;
constexpr double EPS = 1e-8;
long long int N, M, K, H, W, L, R;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> K;
  vector<long double> v(N);
  for (auto &i : v) {
    cin >> i;
    i *= acos(-1) * 2;
    i /= K;
  }
  vector<vector<long double>> edge(N, vector<long double>(N));
  long double sum = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      edge[i][j] = sqrt(2 - 2 * cos(v[i] - v[j]));
      if (i < j) sum += edge[i][j];
    }
  }
  vector<long double> weight(N);
  long double x = 0;
  long double y = 0;
  long double weightsum = 0;
  for (int i = 0; i < N; i++) {
    weight[i] = sum;
    for (int j = 0; j < N; j++) weight[i] -= edge[i][j];
    long double parent = weight[i];
    for (int j = 0; j < N; j++) {
      parent += edge[i][j] * (N - 2);
    }
    weight[i] /= parent;
    x += cos(v[i]) * weight[i];
    y += sin(v[i]) * weight[i];
    weightsum += weight[i];
  }
  x /= weightsum;
  y /= weightsum;
  cout << setprecision(20) << x << " " << y << endl;
}
