#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, s, ans = 0, mid = 0;     scanf( %lld %lld , &n, &s);     long long int a[n];     for (int i = 0; i < n; i++) scanf( %lld , &a[i]);     sort(a, a + n);     mid = n / 2;     if (s >= a[mid]) {       for (int i = n / 2; i < n; i++) {         if (a[i] >= s)           break;         else           ans += abs(s - a[i]);       }     } else {       for (int i = n / 2; i >= 0; i--) {         if (a[i] <= s)           break;         else           ans += abs(a[i] - s);       }     }     cout << ans;     return 0;   }   