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