#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
vector<int> cum, counter;
int main() {
  ios_base::sync_with_stdio(false);
  int n, s;
  cin >> n >> s;
  long long int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  long long int sum = 0;
  int k = n / 2;
  if (arr[k] < s) {
    for (int i = k; i < n; i++) {
      if (arr[i] < s) {
        sum += s - arr[i];
      }
    }
  } else if (arr[k] > s) {
    for (int i = k; i >= 0; i--) {
      if (arr[i] > s) {
        sum += arr[i] - s;
      }
    }
  }
  cout << sum;
  return 0;
}
