#include <iostream>
using namespace std;
int main()
{
    int N;
    double S;
    cin>>N>>S;
    double P[N];
    int i, j, k, S1=0, d;
    for(i=0; i<N;i++)
        cin>>P[i];

    for(i=0; i<N; i++)
        for(j=i+1; j<N; j++){
            if(P[i]>P[j]){
                k=P[i];
                P[i]=P[j];
                P[j]=k;
            }
        }
        if(N%2==0)
            d=N/2;
        else d=N/2+1;

    for(i=0; i<N/2; i++)
        S1+=-P[i];
    for(i=N-1; i>=d; i--)
        S1+=P[i];
    S1=S1-N*S;
    cout<<S1;

}