#include <bits/stdc++.h>
#include <boost/math/constants/constants.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

int main(){
    using namespace std;
    using long_decimal = boost::multiprecision::cpp_dec_float_100;
    long_decimal pi = boost::math::constants::pi<long_decimal>();
    constexpr unsigned long dig = 50;
    unsigned long N, L;
    cin >> N >> L;
    vector<unsigned long> T(N);
    copy_n(istream_iterator<unsigned long>(cin), N, T.begin());
    long_decimal x{0}, y{0};
    vector<long_decimal> C(N), S(N);
    transform(T.begin(), T.end(), C.begin(), [&pi, &L](auto t){return static_cast<long_decimal>(boost::multiprecision::cos(pi * t / L));});
    transform(T.begin(), T.end(), S.begin(), [&pi, &L](auto t){return static_cast<long_decimal>(boost::multiprecision::sin(pi * t / L));});
    for(long i = 1; i < N; ++i){
        for(long j = 0; j < i; ++j){
            long t = N + 2 * (j - i);
            x += t * (C[i] * C[j] - S[i] * S[j]);
            y += t * (C[i] * S[j] + C[j] * S[i]);
        }
    }
    unsigned long t = N * (N - 1) * (N - 2) / 6;
    x /= t;
    y /= t;
    cout << setprecision(15) << fixed << endl;
    cout << x.str(dig, std::ios_base::fixed) << " " << y.str(dig, std::ios_base::fixed) << endl;
    return 0;
}