#include <bits/stdc++.h>
using namespace std;
int n, k;
int ans;
int main() {
  cin >> n >> k;
  int x;
  ans = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> x;
    x = k - x;
    ans += 2 * x - 1;
  }
  ans = max(0, ans);
  cout << ans << "\n";
  return 0;
}
