#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, s;
  cin >> n >> s;
  long arr[n];
  for (long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  long h = n / 2;
  long long c = 0;
  if (arr[h] == s) {
    c = 0;
  } else if (s > arr[h]) {
    long i = h;
    while (i < n) {
      if (arr[i] >= s) {
        break;
      } else {
        long k = s - arr[i];
        c += k;
      }
      i++;
    }
  } else {
    long i = h;
    while (i >= 0) {
      if (arr[i] <= s) {
        break;
      } else {
        long k = arr[i] - s;
        c += k;
      }
      i--;
    }
  }
  cout << c;
}
