#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
int main() {
  long long n, s, i, a, ctr = 0;
  cin >> n >> s;
  for (i = 0; i < n; i++) {
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());
  long long x = n / 2;
  if (v[x] < s)
    while (v[x] <= s && x < n) {
      ctr += s - v[x];
      x++;
    }
  else
    while (v[x] >= s && x >= 0) {
      ctr += abs(s - v[x]);
      x--;
    }
  cout << ctr;
  return 0;
}
