#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
using ll = long long;
using P = pair<ll, ll>;
constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());
class DIncenters {
 public:
  void solve(istream& cin, ostream& cout) {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, l;
    cin >> n >> l;
    vector<int> t(n);
    for (int i = 0; i < (int)(n); i++) {
      cin >> t[i];
    }
    double sumx = 0;
    double sumy = 0;
    for (int i = 0; i < (int)(n); i++) {
      for (int j = i + 1; j < n; j++) {
        double k = (t[i] + t[j]) / 2.0;
        double x = cos(2 * PI * k / l);
        double y = sin(2 * PI * k / l);
        int neg = j - i - 1;
        int pos = n - 2 - neg;
        sumx += x * (pos - neg);
        sumy += y * (pos - neg);
      }
    }
    ll d = n * (n - 1) * (n - 2) / 6;
    cout << setprecision(15) << fixed;
    cout << sumx / d << ' ' << sumy / d << endl;
  }
};
signed main() {
  DIncenters solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
