import numpy as np from numpy.fft import fft, ifft from math import pi n, l = map(int, input().split()) t = np.array(map(int, input().split())) * (2*pi/l) sin = np.sin(t) cos = np.cos(t) x = ifft(fft(cos)*fft(sin)) * np.arange(n) print(np.sum(x))