#include <bits/stdc++.h>
using namespace std;
long long int n, m, a, b, c, d, k, x, y, z, ans = 0, total = 0;
long long int arr[201000] = {0};
int main(void) {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  a = (n / 2);
  ans += abs(arr[a] - m);
  for (int i = a + 1; i < n; i++) {
    if (arr[i] < m) {
      ans += abs(arr[i] - m);
    } else {
      break;
    }
  }
  for (int i = a - 1; i >= 0; i--) {
    if (arr[i] > m) {
      ans += abs(arr[i] - m);
    } else {
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
