Noora is a student of one famous high school. It's her final year in school — she is going to study in university next year. However, she has to get an «A» graduation certificate in order to apply to a prestigious one.In school, where Noora is studying, teachers are putting down marks to the online class register, which are integers from 1 to k. The worst mark is 1, the best is k. Mark that is going to the certificate, is calculated as an average of all the marks, rounded to the closest integer. If several answers are possible, rounding up is produced. For example, 7.3 is rounded to 7, but 7.5 and 7.8784 — to 8. For instance, if Noora has marks [8, 9], then the mark to the certificate is 9, because the average is equal to 8.5 and rounded to 9, but if the marks are [8, 8, 9], Noora will have graduation certificate with 8.To graduate with «A» certificate, Noora has to have mark k.Noora got n marks in register this year. However, she is afraid that her marks are not enough to get final mark k. Noora decided to ask for help in the internet, where hacker Leha immediately responded to her request. He is ready to hack class register for Noora and to add Noora any number of additional marks from 1 to k. At the same time, Leha want his hack be unseen to everyone, so he decided to add as less as possible additional marks. Please help Leha to calculate the minimal number of marks he has to add, so that final Noora's mark will become equal to k.

The first line contains two integers n and k (1 ≤ n ≤ 100, 1 ≤ k ≤ 100) denoting the number of marks, received by Noora and the value of highest possible mark. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ k) denoting marks received by Noora before Leha's hack.

Print a single integer — minimal number of additional marks, that Leha has to add in order to change Noora's final mark to k.

NoteConsider the first example testcase.Maximal mark is 10, Noora received two marks — 8 and 9, so current final mark is 9. To fix it, Leha can add marks [10, 10, 10, 10] (4 marks in total) to the registry, achieving Noora having average mark equal to . Consequently, new final mark is 10. Less number of marks won't fix the situation.In the second example Leha can add [5, 5, 5] to the registry, so that making average mark equal to 4.5, which is enough to have 5 in the certificate.

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long int
#define ld long double
#define F first
#define S second
#define pb push_back

using namespace std;
using namespace __gnu_pbds;

typedef tree<ll, null_type, less<ll>, rb_tree_tag,
tree_order_statistics_node_update>
new_data_set;

const ll N=100005;

int main()
{
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // ll t;
    // cin>>t;
    // while(t--)
    {
        ll i,j,k,n,m,ans=0,cnt=0,sum=0;
        cin>>n>>k;
        ll a[n];
        for(i=0;i<n;i++){
            cin>>a[i];
            sum+=a[i];
        }
        ll lf=-1,rt=1e15;
        while(lf+1<rt){
            ll mid=(lf+rt)/2;
            ld ansd=(ld)(sum+(mid*k))/(ld)(n+mid);
            if((ll)(ansd+0.5)>=k){
                rt=mid;
            }
            else{
                lf=mid;
            }
        }
        cout<<rt;
    }
}

#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <cassert>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <utility>
#include <cmath>
#include <list>
#include <bitset>
#include <iomanip>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ll> vi;
typedef long double ld;
typedef set<int>::iterator sit;
typedef map<int, int>::iterator mit;
typedef vector<int>::iterator vit;
#define fi first
#define se second
#define pb push_back
#define forn(i, n) for (int i = 1; i <= n; i++)
#define fore(i, n) for (int i = 0; i < n; i++)

vector<int> vt;

int main() {
	int n, k;
	cin >> n >> k;
	double s = k - 0.5;
	vt.resize(n);
	fore(i, n) {
		cin >> vt[i];
	}
	int cnt = 0;
	fore(i, n) {
		cnt += vt[i];
	}
	int r = 0;
	double i = 0;
	for (i = vt.size(); ; i++) {
		if (cnt / i > s)break;
		cnt += k;
		r++;
	}

	if(r)printf("%d\n", r - 1);
	else cout << 0;

	return 0;
}

# include <bits/stdc++.h>

using namespace std;

const int N = (int)157;

int n, k;

int a[N];

long double avg;

int main(){
  cin >> n >> k;
  for(int i = 1; i <= n; i++){
    int x;

    cin >> x;
    avg += x;
  }
  if(int(avg / n + 0.5) == k){
    cout << 0;
    return 0;
  }
  for(int i = 1; i <= 500000; i++){
    avg += k;
    if(int(avg / (n + i) + 0.5) == k){
      cout << i;
      return 0;
    }
  }
}

#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#define ll long long
#define ull unsigned long long
#define all(v) ((v).begin()), ((v).end())
#define sz(v)   ((int)((v).size()))
#define forr(c,x,n)  for(long long c=x;c<n;c++)
#define fo(c,n)  for(long long c=n-1;c>=0;c--)
using namespace std;
typedef vector<long long> vi;
typedef set<long long>se;
/*
///////////////////////////////////////////////

**    **           **    *    **    **   **
**   **      *     **  *      **    **   **
**  **     *   *   ***        **    *******
** **     *     *  **         **         **
***      *       * **         **         **
** **     *     *  **     *****          **
**  **     *   *   **    *    **    **   **
**   **      *     **    *    **     **  **
**    **           **     ******       ***

///////////////////////////////////////////////
*/
// start +(end-start)/2
// sum from 1 to n = (n*(n+1))/2
//A=65 // a=97  // num=48
//decimal to binary :: while(n!=0) {r=(n%2==0 ?"0":"1")+r; n/=2;}
//int value = atoi(myString.c_str());
ll gcd(ll a,ll b){
    if(b==0)return a;
    else {
        return gcd(b,a%b);
    }

}
ll lcm(ll a,ll b){
return (a*b)/gcd(a,b);
}
ll revers(ll n){
int ans=0;
while(n){
    ans+=n%10;
    ans*=10;
    n/=10;
}
return ans/10;
}
string revers(string x){
char temp;
ll y=x.length();
forr(c,0,y/2){
temp = x[c];
x[c]=x[y-1-c];
x[y-1-c]=temp;
}
return  x;
}
bool prime(ll n )
{
    if(n==0||n==1)return 0;
    else if(n==2)return 1;
    else
    {
        for(ll c=2;c*c<=n;c++){
            if(n%c==0)return 0;
        }
        return 1;
    }
}
ll fac(ll n){
ll y =sqrt(n),ans=0;
for(ll c=1;c<=y;c++){
    if(n%c==0)ans++;
    if(n/c>y&&n%c==0)ans++;
}
return ans;
}
int numdig (ll n){
int ans=0;
while(n){
    n/=10;ans++;
}
return ans;
}
bool check(string x){
int ans=0;
forr(c,0,x.length())
{
    if(x[c]=='4')ans++;
    else if(x[c]=='7')ans--;
    else return 0 ;
}
if(ans==0)return 1;
else return 0;
}
vi fact; ll divi=2;
void factor(ll num){
if(num==1)return ;
divi=2;
while(num%divi!=0)divi++;
fact.push_back(divi);
factor(num/divi);
}
ll lowsearch(vi arr,ll k){
ll s=0,mid,en=arr.size()-1;
while(s<=en){
    mid=(s+en)/2;
    if(k<=arr[mid])en=mid-1;
    else if(k>arr[mid])s=mid+1;
}
if(en>=0)
return arr[en];
else
    return -1;
}
ll hisearch(vi arr,ll k){
ll s=0,mid,en=arr.size()-1;
while(s<=en){
    mid=(s+en)/2;
    if(k<arr[mid])en=mid-1;
    else if(k>=arr[mid])s=mid+1;
}
if(s<=arr.size()-1)
return arr[s];
else
    return -1;
}
int main()
{
 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 int n,k,ans=0,x,num=0;
 cin>>n>>k;
 num=n;double sum1,sum=0;
 forr(c,0,n){cin>>x;sum+=x;}
 while(sum1<1000000){
        sum1=sum/num;
    if(sum1==k||(k-sum1)<=.5){cout<<ans<<endl;break;}
    ans++;
    num++;
    sum+=k;
 }

return 0;
}

# include <bits/stdc++.h>
using namespace std;

int main()
{
    int n,k,aver,c,count;
    float z,sum,d;
    cin>>n>>k;
    double a[n];
    sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum=sum+a[i];
    }
    z=n;
    aver=round(sum/z);
    count=0;
    c=aver;
    for(int l=1;c<k;l++)
    {
        sum=sum+k;
        d=n+l;
        c=round(sum/d);
        count++;
    }
    cout<<count<<endl;
    return 0;
}

/*
rohit645
Rohit Kumar
*/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef double ld;
typedef pair < ll, ll > pll;
typedef vector < vector < ll > > matrix;

#define pb push_back
#define debug(x) cout << (#x) << " is " << (x) << endl
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll mod = 1e9 + 7;
const ll inf = LLONG_MAX;
const ll N = 1e5 + 10;

int main (void) {
    fast_io();
    ll k;
    double n;
    cin >> n >> k;
    ll temp = n;
    ll arr[temp];
    ll sum = 0;
    for (ll i = 0; i < temp; i++) {
        cin >> arr[i];
        sum += arr[i];
    }
    double cur_avg = sum / n;
    // debug(cur_avg);
    if (round(cur_avg) >= k) {
        cout << "0\n";
    }
    else {
        ll cnt = 0;
        while (round(cur_avg) < k) {
            sum += k;
            ++n;
            cur_avg = sum /(n);
            // debug(n);
            // debug(cur_avg);
            // debug(sum);
            cnt++;
            // debug(cur_avg);
            // debug(sum);
            // debug(n);
            // debug(round(cur_avg));
            // if (n == 7) {
            //     return 0;
            // }

        }

        cout << cnt << "\n";
    }

    return 0;
}

#include<iostream>
using namespace std;
int main()
{ int i,a,sum=0,t, j;
   float n, m;
   cin>>n>>m;
   for(i=0; i<n;i++)
   { cin>>a;
     sum+=a;
   }
     if((sum/n)>=(m-0.5))
     {
       cout<<0<<endl;
     }
     else
     {
    j=(sum-((m-0.5)*n))/((m-0.5)-m);
    if(j<0)
    {j=-j;
    }
    cout<<j<<endl;
    }
return 0;
}

#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#define lli long long int
#define loop(i,x,n) for(int i=x;i<n;i++)
#define loopr(i,x,n) for(int i=n-1;i>=x;i--)
#define st set<lli>
#define v vector<lli>
#define um unordered_map<lli,lli>
#define vpl vector<pair<lli,lli>>
#define llu long long unsigned
#define ms muliset<int,greater<int>>
#define ums unordered_map<string,lli>
#define pb push_back
#define time ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define test lli t; cin>>t; while(t--)
using namespace std;
int gcd(int a,int b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}
v adj[100001];
lli vist[10001];

void dfs(lli node)
{
    vist[node]=1;
    for(lli child : adj[node]) if(!vist[child]) dfs(child);
}

int main()
{
    time
    lli n;
    cin>>n;
    double b;
    cin>>b;
    double b1=b-0.50;
    double avg=0;
    loop(i,0,n) { double d; cin>>d; avg+=d;}
    double avg1 = avg/n;
    lli c=0;
    while(avg1<b1)
    {
        n++;
        c++;
        avg+=b;
        avg1 = avg/n;
    }
    cout<<c<<endl;
    return 0;
}

#include<cstdio>
const int maxn = 110;
int a[maxn];
int main() {
	int n, k;
	int m;
	scanf("%d%d", &n, &k);
	for (int i = 0;i < n;i++)
		scanf("%d", a + i);
	m = 2 * k*n - n;
	for (int i = 0;i < n;i++)
		m -= 2 * a[i];
	printf("%d\n", m > 0 ? m : 0);
	return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

double sum,temp;
int n,a;
double k;
int main()
{
    cin>>n>>k;
    for (int i=0;i<n;i++)
    {
        cin>>a;
        sum+=a;
    }
    temp=sum/(n*1.0);
    int count=0;
    while (temp<k-0.5)
    {
        count++;
        sum+=k;
        temp=sum/((++n)*1.0);
    }
    cout<<count<<endl;
    return 0;
}

#include <iostream>

using namespace std;

int notas[1000];

int main()
{
    int n,k,sum,coc; cin >> n >> k; sum = 0;
    long long w;
    double res;

    for (int i = 0; i < n; i++)
    {
        cin >> notas[i];
        sum += notas[i];
    }

    res = (sum%n);
    coc = sum/n;
    //cout << sum << " " << res << " " << coc << endl;
    if ((res >= n/2 && coc >= k-1)||(res == 0 && coc == k))
    {
        cout << 0;
    }
    else
    {
        w = 2*((k*n)-sum-(0.5*n));
        cout << w;
    }
}

#include<bits/stdc++.h>
using namespace std;
int main()
{int n,m;
 cin>>n>>m;
 double sum=0;
 int x;
 for (int i=1;i<=n;i++){cin>>x;sum+=x;}
 int z=m;
 for (int i=0;;i++)
   {if(floor(sum/(n+i)+0.5)==m) {cout<<i;return 0;}
    sum+=z;}
}

#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ll long long
#define mp make_pair
#define pii pair<int,int>
#define mod 1000000007
#define M 1000000
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    long t;
    //cin>>t;
    t= 1;
    while(t--)
    {
        ll n, k;
        cin >> n >> k;
        ll a[n];
        ll sum= 0;
        for(ll i=0;i<n;i++)
        {
            cin >> a[i];
            sum+= a[i];
        }
        double res= k-0.5;

        //sum+ ans.k= res.n+ res.ans
        //ans.0.5= res.n-sum

        ll ans= (res*n - sum)*2;
        if(ans<0)
        cout << 0;
        else
        cout << ans;

    }
}

///MD.Himon Shekh

#include<bits/stdc++.h>
using namespace std;
//#define pi 2.0*acos(0.0)
#define nl '\0'
//#define sort(srt,n,grt)  sort(srt, srt+n, greater<int>());
//#define sort(srt,n) sort(srt,srt+n);
#define inf 1000000000
#define mem(a, b) memset(a, b, sizeof(a))
#define memc(arr,ar) memcpy(arr, ar, sizeof(arr))
#define all(x) (x).begin(), (x).end()///reverse(all(s));
typedef unsigned long long ull;
typedef long long ll;

//const int N = 1e7 + 7;
//bool used[N];

int main()
{
    double n,k,m,totm=0,ad,num;
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>m;
        totm+=m;
    }
    double av=totm/n;
    int in=av;
    if(in==av){}
    else {
        double dis=av-in;
        if(dis>=0.5)in++;
    }
    av=in;
    if(av>=k){
        cout<<"0"<<endl;return 0;
    }
    ad=av+1;
    if(ad>=k)ad=k;
    num=n;
    double tot=totm;
    while(av!=k){
        totm+=ad;n++;
        av=totm/n;
        in=av;
        //cout<<in<<" "<<av<<" "<<ad<<endl;
        if(in==av){}
        else {
            double dd=av-in;
            if(dd>=.5){
                in++;
                av=in;
                if(av!=k){ad++;
                        if(ad>k)ad=k;
                        else{totm=tot;
                        n=num;}
                }
            }
        }
    }
    cout<<n-num<<endl;
return 0;
}

#include <cstdlib>
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <complex>
using namespace std;
typedef long long         ll;
ll modulo(ll m , ll n){
    return m >= 0 ? m%n : (n-abs(m%n))% n ;
}
int main() {
   ll n , k ,y;
    cin>>n>>k;
  float sum=0 ;
    for(int i =0 ; i <n ; i++){
        cin >> y;
        sum+=y;
    }
if( round ( sum/n ) +0.5 >= (k) ) {
            cout << 0 ;
            return 0;
        }
    for(int i =1 ; i <=100000000 ; i++){
        sum+=k ;

        if( ( round( sum/(n+i) ) +0.5)   >= k ) {
            cout<< i ;
            return 0;
        }
    }

}

#include<iostream>

using namespace std ;

#include<iostream>

using namespace std ;

int main()
{
int n;
float k;
cin>>n>>k;
float a[n];
int sum=0;
for(int i=0;i<n;i++){
	cin>>a[i];
	sum+=a[i];
}

if(sum/float(n)>=(k-0.5))
{
	cout<<0;
}
else{
cout<<2*k*n - 2*sum - n;
}
return 0;
}

#include <iostream>

using namespace std;

int main()
{
    float n,i,m,s=0,j;
    float p=0,k;
    cin>>n>>k;
    for(i=0;i<n;i++)
    {
        cin>>m;
        s=s+m;
    }

    j=k*2*n-n-2*s;
    if(j>=0)
    {
      cout<<j;
    }
    else
    {
        cout<<"0";
    }

        return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL N,K;
LL sum=0;
LL toint(double aa) {
  return floor(aa+0.5);
}
LL solve() {

  cin>>N>>K;
  for(LL i=1;i<=N;i++) {
    LL xx;scanf("%I64d",&xx);
    sum+=xx;
  }

  double x=2*N*(K-0.5)-2*sum;

  return max(0LL,(LL)ceil(x));
}
int main() {
  printf("%I64d\n",solve());
  return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
	int n,k ,i;
    double avg,sum=0;
	scanf("%d %d",&n,&k);
	int c[n];
	for(i=0;i<n;i++)
		scanf("%d",&c[i]) ;
	for(i=0;i<n;i++)
	{
		sum=sum+c[i];
	}

	avg=sum/n;

	if(round(avg)==k)
		printf("0");
	else
	{
        for(i=1; ;)
		{
			sum=sum+k;

			if(round(sum/(n+i)) ==k)
			{printf("%d",i);
			break;

			}
			else
				i++;
		}

	}
}

#include<bits/stdc++.h>
using namespace std;

#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define ld long double
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n
#define pl(n) cout<<n
#define sze(v) (int)(v.size())

typedef vector<int>Vl;
typedef pair<int,int>pii;
typedef vector<pii>Vll;
typedef vector<vector<int>>Vv;
typedef vector<pair<int,pii> >Vlll;
typedef priority_queue <int, vector<int>, greater<int>>PQL;
typedef unordered_map<int,int>ump;

const int mod=1e9+7;
const int modx=998244353;
const int Nx=1e5+2;
const int inf= (int)(1e19+10LL);
bool poss(Vl arr,int md,int k,int sum){
	int val=k*md;
	sum=sum+val;
	ld avg=(1.0*sum)/(sze(arr)+md);

	if((avg+0.5)>=k)return true;
	return false;
}

void solve(){
   int n,k;
   sl(n);sl(k);
   Vl arr(n);
   int sum=0;
   for(int i=0;i<n;i++){
	   sl(arr[i]);
	   sum+=arr[i];
   }
   int low=0,high=(sum/n)+100000,ans;

   while(low<high){
	   int md=(low+high)/2;
	   if(poss(arr,md,k,sum)){
		   ans=min(ans,md);
		   high=high-1;
	   }
	   else{
		   low=low+1;
	   }
   }
   cout<<ans<<endl;

}

signed main(){
   int test=1;
   //sl(test);
   while(test--){
      solve();

   }
  return 0;
}

#include <iostream>
using namespace std;

int n,k,sum,ans;
int a[110];

int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;++i) cin>>a[i],sum+=a[i];
	while(1)
	{
		if((int)(sum*1.0/n+0.5)==k) break;
		sum+=k; n++; ans++;
	}
	cout<<ans<<endl;
	return 0;
}

#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <ctime>

using namespace std;

const int len = 100010;
int n;
double ave,a[len],k;

int main() {
 //freopen("test.in","r",stdin);
 cin >> n >> k;
 double sum=0;
  for (int i=1;i<=n;i++) {
   cin >> a[i];
   sum+=a[i];
  }
  if (sum/n>=k-0.5)
  cout << 0 << endl;
  else {
  int i=1;
   while (ave<k-0.5) {
    sum+=k;
    ave=sum/(i+n);
    i++;
   }
   cout << i-1 << endl;
  }
 return 0;
}

/*
ID: mcbelgu1
TASK: gift1
LANG: C++14
*/
#include<bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define freopen freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define MOD 998244353
#define IOS ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);
ll mx=-1e9,mn=1e9+5;
ll T,n,m,k,ans,a[200],b[200],c[200],d[200],l,r,sum,mid,coin,cnt,pos,number,x,y,z;
vector<ll> v,v1;
map<ll,ll> mp,mm;
map<ll,ll> :: iterator it;
pair<ll,ll> p[1005];
queue<ll> q;
priority_queue<ll> pq;
char ch[1000][1000];
int main(){
	cin>>n>>k;
	for(int i=1; i<=n; i++){
		cin>>a[i];
		sum+=a[i];
	}
	double dave=k-0.5;
	for(int i=1; i<=100000; i++){
		double dsum=sum;
		double total=(n+i-1);
		double dd=dsum/total;
		if(dd>=dave){
			cout<<i-1;
			return 0;
		}
		sum+=k;
	}
}

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include <bitset>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(NULL), cout.tie(NULL);
	int n, k,sum=0,a;
	cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
		cin >> a;
		sum += a;
	}
	int av = sum / n;
	if ((av >= k) || ((sum%n) * 10)/n >= 5 && av == k - 1)
	{
		cout << 0 << endl;
		return 0;
	}
	else
	{
		int c = 0;
		while (1)
		{
			if ((av >= k) || (((sum%(n+c)) * 10)/(n+c)) >= 5 && (av == k - 1))
				break;
			c++;
			sum += k;
			av = sum / (n + c);
		}

		cout <<c<< endl;

	}
	return 0;
}

#include <bits/stdc++.h>
#define mp make_pair
using namespace std;
typedef pair<int, int> pii;

int n, k, m;
long long ans, tmp;
int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin>> n >> k;
	ans = 0;
	m = 0;
	for(int i = 0; i < n; i++) {
		cin>> tmp;
		ans += tmp;
	}
	int l = 0; int r = 300000;
	while(l <= r) {
		m = (l + r)/2;
		double tt = (double)(ans + m*k)/(n + m);
		if(tt < k - 0.5)
			l = m + 1;
		else
			r = m - 1;
	}
	if((double)(ans + m*k)/(n + m) < (k - 0.5)) m++;
	//if((double)(ans + (m - 1)*k)/(n + m - 1) > (k - 0.5)) m--;
	cout<< m << endl;
	return 0;
}

# include<iostream>
using namespace std;
int n,k,l;
double s,j;
int mas[1000];
int main()
{
cin>>n>>k;
l=n;
for(int i=0; i<n; i++)
{
cin>>mas[i];
s=s+mas[i];
}
j=s/n+0.5;
int g=j;
if(g==k)
cout<<0<<endl;
else
{
while(true)
{
   l++;
   s=s+k;
  j=s/l+0.5;
  g=j;
   if(g==k)
   {
           cout<<l-n<<endl;
           break;
           }
           }
           }

           return 0;
           }

#include<bits/stdc++.h>
using namespace std;

int n,k,sum=0,cnt=0;

int main()
{

    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        sum+=x;
    }
    double tb=(double)sum/n;
    while( tb <(double)(k-0.5))
    {
        cnt++;
        sum+=k;
        tb=(double)sum/(n+cnt);
    }
    cout<<cnt;
}

#include<stdio.h>
int n,k,a,sum;
main()
{
	scanf("%d%d",&n,&k);for(register int i=n;i--;){scanf("%d",&a);sum+=a;}
	for(register int i=0;;++i)
		if((int)((sum+k*i)*1./(n+i)+0.5)==k){printf("%d",i);return 0;}
}/**/

#include<bits/stdc++.h>
using namespace std;
int summ(int n)
{
     int sum=0;
     while(n)
     {
          int m=n%10;
          sum+=m;
          n/=10;
     }
     return sum;
}
int main()
{        int n,k;
        double sum=0.0,c=0;
        cin>>n>>k;
        int a[n];
        for(int i=0;i<n;i++)
        {
             cin>>a[i];
             sum+=a[i];
        }
        double x=sum/n;
        if(x>=k-0.5)
        cout<<0;
        else
        {
             for(int i=1;i<100000;i++)
             {
                  sum=sum+k;
                  n++;
                  c++;
                  if(sum/n>=k-0.5)
                  break;
                  else
                  continue;
             }
             cout<<c;
        }

}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <bitset>
#include <set>
#include <list>
#include <deque>
#include <map>
#include <queue>
#define MOD 1000000007
using namespace std;
typedef long long ll;
const double pi=acos(-1.0);
const double eps=1e-6;
const int INF=1000000000;
const int maxn=100010;
const int maxm=10010;

int n,k,tmp,ans=0;
double sum=0.0;

int main()
{
	scanf("%d %d", &n, &k);
	for(int i=0;i<n;++i)
	{
		scanf("%d", &tmp);
		sum+=tmp;
	}
	ans=ceil(2.0*n*k-n-2.0*sum);
	ans=max(0,ans);
	printf("%d\n", ans);
    return 0;
}

#include<iostream>
#include <stdio.h>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
#include <stack>
using namespace std;
struct tt{
	int x,y;
};

int main(){
	int i,j,k,l,f1,f2,f3,f4,t1,t2,t3,t4;
	//freopen("in.txt","r",stdin);
	int r,c;
	int n,m;
	cin >> n>> m;
	double g1=0,g2,g3;
	for(i=1;i<=n;i++){
		cin >>t1;
		g1+=t1;
	}
	i=n;
	for(j=1;;j++){
		g2=g1/n;
		g3=g2+0.5-m;
		if(g3>=0)break;
		n++;
		g1+=m;
	}
	cout << n-i << endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,k,i,sum=0,avg_int,result=0,num,c=0,p_int,r=0,l=0;
    float avg=0,sub,p,sub1;
    cin >> n >> k;
    num=n;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin >> a[i];
        sum = sum+a[i];
    }
    avg_int = sum/n;
    avg = (float)sum/n;
    //printf("%f",avg);
    if(avg>=avg_int){
        sub = avg - avg_int;
    }
    else{
        sub = avg_int-avg;
    }

    if(sub>=0.5 && avg>=avg_int)
    {
        result = avg_int+1;
    }
    else if(sub>=0.0 && sub<=0.49 && avg>=avg_int)
    {
        result =avg_int;
    }

    if(result==k)
    {
       printf("0");
    }

    if(result<k)
    {
        while(sum!=0)
        {
            num++;
            c++;
            sum = sum+k;
            p =(float)sum/num;
            p_int = sum/num;
            if(p>=p_int)
            {
                sub1 = p-p_int;
            }
            else{
                sub1 = p_int-p;
            }

            if(sub1>=0.5 && p>=p_int)
            {
                r = p_int+1;
            }
            if((sub1<=0.49 && sub1>=0.1)&& (p>=p_int))
            {
                r = p_int;
            }

            if(r==k)
            {
                l=1;
                break;
            }

        }
    }
    if(l==1)
    {
       printf("%d",c);
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main()
	{
	ios_base::sync_with_stdio(false);
	int n, k, i, sum=0,m;
	cin>>n>>k;
	int arr[n];
	for(i=0;i<n;i++)
		{
		cin>>arr[i];
		sum=sum+arr[i];
		}
	if(2*sum<n*(2*k-1))
		{
		m=n*(2*k-1)-2*sum;
		cout<<m<<endl;
		}
	else
		cout<<"0"<<endl;
	return 0;
	}

#include <bits/stdc++.h>
#define LL long long
using namespace std;
LL n, k, s = 0, x, a;
int main()
{
    scanf("%lld%lld", &n, &k);
    for(LL i = 0; i < n; i++)
	{
        scanf("%lld", &x);
        s += x;
    }
    a = (2 * k - 1) * n - 2 * s;
    if(a < 0)
		a = 0;
    printf("%lld", a);
    return 0;
}

#include <iostream>
using namespace std;

 int main()
 {
 	int n,k,s=0,t,c=0;
 	cin>>n>>k;
 	while(n){cin>>t;s+=t;--n;++c;}
 	t=(2*k-1)*c-s*2;
 	if (t>0) cout<<t;
 	else cout<<0;
 }

#include<bits/stdc++.h>
using namespace std;
int main()
{	ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n,k,sum=0;
	float m;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];

	}
	m=(float)sum/n;

	if(m>=k-0.5)
	{cout<<"0";
}
	else
	cout<<((2*k-1)*n-2*sum);
}

#include <iostream>
using namespace std;

int round(double number){
    return (number > 0.0) ? (number + 0.5) : (number - 0.5);
}

int main() {
	int n,m;
	cin>>n>>m;
	double sum=0;
	for(int i=0;i<n;i++){
		double a;
		cin>>a;
		sum+=a;
	}
	int ans=0;
	while(round(sum/(n+ans))!=m){
		ans++;
		sum+=m;
	}
	cout<<ans;
	return 0;
}

#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<set>
using namespace std;
const long long MOD = 1000000007;
void main() {
	long long n, m, d, n1,s=0;

	vector<int> OT;
	string s1, s2;
	cin >> n >> m;
	n1 = n;
	while (n > 0) {
		n--;
		cin >> d;
		s = s + d;
	}
	cout <<max(long long(0), 2 * n1*m - n1 - 2 * s);
//system("pause");
}

#include<bits/stdc++.h>
using namespace std;

//var
int n,k,a,su = 0,us = 0;

int main(){
	cin >> n >> k;
	for(int i = 1; i<=n; i++){
		cin >> a;
		su += (k-a);
	}
	cout << max(0,2*su - n) << endl;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,x,sum,da;
int main(){
	scanf("%lld%lld",&n,&k);
	for (int i=1;i<=n;i++){
		scanf("%lld",&x); sum+=x;
	}
	while (k!=round((sum+k*da)/1.0/(n+da))) da++;
	printf("%d",da);
    return 0;
}

#include<bits/stdc++.h>

typedef long long ll;

using namespace std;
const ll INF = 10e17+7;

int main() {
   int n,k,m,sum=0,c=0;
   cin>>n>>k;
   for(int i=0;i<n;i++)
   {
       cin>>m;
       sum+=m;
   }
   double q=double(k)-0.5;
   //cout<<q;

   while(1)
   {
        if(sum+k*c>=q*(n+c))
            return cout<<c,0;
        c++;
   }
   //cout<<"0";

}

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL N,K;
LL sum=0;
LL toint(double aa) {
  return floor(aa+0.5);
}
LL solve() {

  cin>>N>>K;
  for(LL i=1;i<=N;i++) {
    LL xx;scanf("%I64d",&xx);
    sum+=xx;
  }

  double x=2*N*(K-0.5)-2*sum;

  return max(0LL,(LL)ceil(x));
}
int main() {
  printf("%I64d\n",solve());
  return 0;
}

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int n, k, sum = 0;
    cin >> n >> k;
    for(int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;
        sum += x;
    }
    int le = -1, ri = 1e7;
    while(ri - le > 1)
    {
        int m = (ri + le) / 2;
        double res = double(sum + m * k) / (n + m);
        int x = int(res + 0.5);
        if(x < k)
            le = m;
        else
            ri = m;
    }
    cout << ri << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
long long GCD(long long  n1, long long n2)
{
    if (n2 != 0)
        return GCD(n2, n1 % n2);
    else
        return n1;
}
long long LCM(long long  n1, long long n2)
{
    long long m;
    m=n1*n2/GCD(n1,n2);
    return m;
}
unsigned long long choose(unsigned long long n, unsigned long long k)
{
    if (k > n)
    {
        return 0;
    }
    unsigned long long r = 1;
    for (unsigned long long d = 1; d <= k; ++d)
    {
        r *= n--;
        r /= d;
    }
    return r;
}
bool isprime(int x)
{
    if(x==1)
        return 0;
    for(int i=2; i*i<x; i++)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
long long mod=1000000007;
long long pow_(long long base, long long exponent, int modulus)
{
    long long result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base) % mod;
        exponent = exponent >> 1;
        base = (base * base) % mod;
    }
    return result;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    /*********************/
    int n,k;double sum;
    cin>>n>>k;
    double arr[1000];
    for(int i=0;i<n;i++)
        {
            cin>>arr[i];
            sum+=arr[i];
        }
    long long mn=1e9;
    for(int i=1;i<=k;i++)
    {
        long long j=0;
        for(j;j<=100000;j++)
        {
            double a=(sum+i*j)/(j+n);
            long long b=(long long)round(a);
            if(b>=k)
            {
                mn=min(j,mn);
                break;
            }
        }
    }
    cout<<mn<<endl;
  return 0;
}

#include<iostream>

using namespace std;

int main()
{
	int res[105];
	double sum=0,n=0, k=0;
	cin >> n >> k;
	double sub = n+1,ss=n;
	for (int i = 0; i < n; i++)
	{
		cin >> res[i];
		sum += res[i];
	}
	if (sum / n >= (k - 0.5))
	{
		cout << 0 << endl;
		return 0;
	}

	while(1)
	{
		if (((sum + k) / sub) >= (k - 0.5))
		{
			cout << sub - ss << endl;
			break;
		}
		else
		{
			sub++;
			sum += k;
		}
	}
	return 0;

}

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

//author:satwik_bhv1
#include<bits/stdc++.h>
//datatypes
#define ll long long
#define ld long double
//loops
#define fr(i,z,n) for(ll i=z;i<n;i++)
#define br(i,z,n) for(ll i=z;i>n;i--)
//operations
#define mp  make_pair
#define ff  first
#define ss  second
#define pub push_back
//map
#define mi map<ll,ll>
//vectors
#define vi vector<ll>
#define vpi vector<pair<ll,ll> >
//constants
#define pi 3.1415926535897932384626
#define mod 998244353
/*notes
    Don't use inbuilt fun for power
    Range of longlong=(-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 )
    INT_MAX = 2147483647(aprox 2*10^10)
    INT_MIN = -2147483648
    LLONG_MAX = 9223372036854775807
    LLONG_MIN = -9223372036854775808
    MST -> kruskal(DSU)
    sssp -> Dijkstras
    apsp -> Floydwarshall
    __gcd is the function in built for hcf
*/
//start
using namespace std;
//functions
void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }
bool sortbysec(const pair<ll, ll>& a, const pair<ll, ll>& b) { return (a.second < b.second); }
void solve()
{
    ll n,k;
    cin>>n>>k;
    ll sum=0;
    fr(i,0,n)
    {
        ll a;
        cin>>a;
        sum+=a;
    }
    ll cnt=0;
    while((ld)sum<(ld)(k-0.5)*(ld)n)
    {
        cnt++;
        n++;
        sum+=k;
    }
    cout<<cnt;
}
int main()
{
    fast();
    ll t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
}

/*
  -------------
  Prateek Celly
  DA-IICT
  -------------
*/
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define f first
#define s second
#define MOD 1000000007

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll n,k,sum=0,j=1,x; cin>>n>>k;
  for(ll i=0;i<n;i++) {cin>>x; sum+=x;}
  float v=float(sum)/n;
  if(v<(floor(v)+ceil(v))/2) v=floor(v); else v=ceil(v);
  while(v<k){
    sum+=k;
    v=float(sum)/(n+j);
    if(v<(floor(v)+ceil(v))/2) v=floor(v); else v=ceil(v);
    j++;
  }
  cout<<j-1;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
int a[100000];
int main()
{
  int n,k,ans=0,x,sum=0;
  cin>>n>>k;
  bool f=0;
  for(int i=0; i<n; i++)
  {
    cin>>x;
    sum+=x;
  }
  while(1)
  {
    if(round(sum*1.0/(n+ans))==k)
    {
    	cout<<ans<<endl;
    	return 0;
	}
      sum+=k;
    ans++;
  }
  return 0;
}

#include <iostream>
using namespace std;
int n,i,p,sum,ans;
double m,k;
int a[101];
int main ()
{
	cin>>n>>k;
for (i=1; i<=n; i++)
{
cin>>a[i];
sum+=a[i];
}

if ((1.0*sum/n+0.5)>=k) {cout<<0<<endl; return 0;}
p=n+1;
while (true)
{
sum+=k;
m=1.0*sum/p;
if ((m+0.5)>=k) {ans=p-n; break;}
else
p++;
}
cout<<ans<<endl;
return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    double ave;
    int k,n,total=0,res;
    int a[101];
    cin>>n>>k;
    res=n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        total+=a[i];
    }
    ave=double(total)/double(n);
    while(ave<k-0.5)
    {
        res++;
        total+=k;
        ave=double(total)/double(res);
    }
    cout<<res-n<<endl;;
    return 0;
}

#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

ll a[102];
int main()
{
    double n,k;
    cin>>n>>k;
    double sum=0;
    double ans=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if((sum/n)<(k-.5))
    ans=2*(double)(n*k-(double)n/2-sum);
    else
        ans=0;
    cout<<ans<<endl;
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int n, k;
    float sum = 0;
    int num;
    cin>>n>>k;
    for(int i = 0; i < n; i++) {
        cin>>num;
        sum += num;
    }
    if(sum / n <= k && sum / n >= k - 0.5) {
        cout<<"0";
    } else {
        cout<<((k * n * 2) - sum * 2 - n);
    }

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << ' ' << to_string(H);
  debug_out(T...);
}

#define debug(...) cerr << '[' << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int f(double s, double n, double k) {
  return -ceil(2 * (s - n * (k - 0.5)));
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<int> arr(n);
  double s = 0;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    s += arr[i];
  }
  if (s / n >= k - 0.5) {
    cout << 0 << '\n';
  } else {
    int ans = 1e9, num = 1e9;
    for (int i = k; i >= 1; --i) {
      if (f(s, n, k) > 0) {
	ans = f(s, n, k);
	num = i;
	break;
      }
    }
    for (int i = 0; i < ans; ++i) {
      s += num;
    }
    assert (ans > 0 && s / (n + ans) >= k - 0.5);
    cout << ans << '\n';
  }
  return 0;
}

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <array>
#include <string.h>
#include <ctime>
#include <memory>
#include <typeinfo>
#include <cmath>
#include <math.h>
#include <initializer_list>

int main() {
    std::ios_base::sync_with_stdio(false);
    int n, ans = 0;
    double k, s = 0;
    std::cin >> n >> k;
    std::vector<int> v(n);
    for(int i = 0; i < n; i++){
        std::cin >> v[i];
        s += v[i];
    }
    if(s / n >= k - 0.5)
        std::cout << ans;
    else{
        while(true){
            s += k;
            n++;
            ans++;
            if(s / n >= k - 0.5){
                std::cout << ans;
                break;
            }
        }
    }
    return 0;
}

#include <iostream>
#include <math.h>
#include <algorithm>

using namespace std;

int main() {
	long long ans, k, n, now, sum = 0, x;
	cin >> n >> k;
	for (int i = 0; i < n; i ++) {
		cin >> now;
		sum += now;
	}
	ans = ceil(2 * (n * (k - 0.5) - sum));
	x = 0;
	cout << max(ans, x) << endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	double x,i,j,n,k;
	long long c=0;
	vector<double>v;
	double d,sum=0;
	cin>>n>>k;
	for(i=0;i<n;i++){
		cin>>x;
		v.push_back(x);
		sum+=x;
	}
	while(1){

		d=sum/(n+c);
		if(d>=(k-0.5)){
			break;
		}
                sum+=k;
		c++;
	}
	cout<<c<<"\n";
}

#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<map>
using namespace std;
long long func1(int n);
long long func2(int A,int B);
long long com[160000],a[300008];
int main()
{

    int n,m;
    while(cin>>n>>m!=NULL)
    {
        int N=n,sum=0,ans=0;
        double fin=m-0.5;
        while(N--)
        {
            int t=0;
            cin>>t;
            sum+=t;
        }
        if(sum/(n*1.0)>=fin)
        {
            cout<<ans<<endl;
            continue;
        }
        while(1)
        {
            sum+=m;
            n++;
            ans++;
            if(sum/(n*1.0)>=fin)
            {
                cout<<ans<<endl;
                break;
            }
        }
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
    //   freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    long long n,k;
    cin>>n>>k;
    int a[n];
    long long s=0;
    for(int i=0;i<n;i++)
    {cin>>a[i];s+=a[i];}
    long long c=0;
    if((s%n>=(n+1)/2 && s/n>=k-1) || (s%n==0&& s/n==k))
    cout<<0;
    else
    {
    for(long long i=0;i<=10000000;i++)
    {
        s+=k;
        n++;
        c++;
        if((s%n>=(n+1)/2 && s/n>=k-1) || (s%n==0&& s/n==k))
        break;
    }
    cout<<c;
    }
}

# include <bits/stdc++.h>

using namespace std;

const int N = (int)157;

int n, k;

int a[N];

long double avg;

int main(){
  cin >> n >> k;
  for(int i = 1; i <= n; i++){
    int x;
    cin >> x;
    avg += x;
  }
  if(int(avg / n + 0.5) == k){
    cout << 0;
    return 0;
  }
  for(int i = 1; i <= 500000; i++){
    avg += k;
    if(int(avg / (n + i) + 0.5) == k){
      cout << i;
      return 0;
    }
  }
}

#include<bits/stdc++.h>
using namespace std;
int a,n,sum,k;
int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		sum+=a;
	}
	for(int i=0;;i++)
	{
		if(floor(1.0*(sum+i*k)/(n+i)+0.5)==k)
		{
			cout<<i<<endl;
			return 0;
		}
	}
}

#include<iostream>
#include<string.h>

using namespace std;
int main()
{

    int n,k;double sum=0;
    cin>>n>>k;
    double a[n];
    for(int i=0;i<n;i++)
    {  cin>>a[i];
        sum+=a[i];
    }
    int count=0;
    double rand=k-1.0;
    rand=rand+0.5;

    while(1)
    {
        if((sum/n)>=rand)
        {  cout<<count<<endl;
            break;}
        sum+=k;
        n++;
        count++;
    }

}

#include <bits/stdc++.h>

using namespace std;

int n,k;
int sum;
int i,j;

bool sat(int x)
{
	double a=(sum+k*x)*1.0/(n+x);

	if (a<k-0.5)
		return false;
	else
		return true;
}

int main()
{
	cin>>n>>k;
	int x;
	for (i=1;i<=n;i++)
	{
		cin>>x;
		sum+=x;
	}
	x=0;
	while (!sat(x))
		x++;
	cout<<x<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int rVAL(int a,int b)
{
    double c,d,avg;
    c=(double)a/(double)b-a/b;
    if(c<0.5)
        return a/b;
    else
        return a/b+1;

}

int main()
{
    int n,k,i,sum=0,avg=0;
    scanf("%d %d",&n,&k);
    double x=0,t=k-0.5;
    int a[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    avg=rVAL(sum,n);

    x=(t*(double)n-(double)sum)*2;
    if(x>0)
        printf("%0.0lf\n",x);
    else
    cout<<"0"<<endl;

}

#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
int n, a[101], k, t = 0;
int main()
{
	cin >> n >> k;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		t += a[i];
	}
	for(int i = 0;; i++){
		if(i != 0)
			t += k;
		//cout << t << endl;
		if(i != 0)
			n++;
		double m =(double) t / n;
		//cout << "m=" << m << ' ' << int (m + 0.5) << endl;
		if(int(m + 0.5)== k){
			cout << i << endl;
			return 0;
		}
		//if(i == 10)
			//return 0;
	}
	return 0;
}

/*#include<bits/stdc++.h>
using namespace std;
int i,j,k,l;
int main()
{
    double n,k;
    while(scanf("%lf%lf",&n,&k)!=EOF)
    {
        double sum=0;
        int ans=0;
        for(i=0;i<n;i++)
        {
            double temp;
            scanf("%lf",&temp);
            sum+=temp;
        }
        while(sum*1.0/n<(k-0.5))
        {
            sum+=k;
            n++;
            ans++;
        }
        printf("%d\n",ans);
    }
    return 0;
}*/
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=1e6;
int main(){
    int a[100];
    int n,m;
    double sum,ave;
    while(~scanf("%d",&n)){
        scanf("%d",&m);
        sum=0;
        for(int i=0;i<n;i++){
            scanf("%d",&a[i]);
            sum+=a[i]*1.0;
        }
        ave=sum/n;
        if(ave>=(m*1.0-0.5)) printf("0\n");
        else{
            for(int i=1;i<=N;i++){    //�����NҪ��һЩ����һ��ʼд��i<=n*m,̫С�ˣ���wa(�i�s^�t�i)
                sum+=m*1.0;
                ave=sum/(n+i);
                if(ave>=(m*1.0-0.5)){
                    printf("%d\n",i);
                    break;
                }
            }
        }
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	double sum=0;
	int x;
	for (int i=1;i<=n;i++){
		cin>>x;
		sum+=x;
	}
	int z=m;
	for (int i=0;;i++){
	if(floor(sum/(n+i)+0.5)==m) {
		cout<<i;return 0;}
		sum+=z;

	}
}

#include <iostream>

using namespace std;

int main(){
int n,k;
cin>>n>>k;
int nf=0,mrk;
while(n){
    n--;
    cin>>mrk;

    nf+=2*(k-mrk)-1;
}
if(nf<0)cout<<0;
else cout<<nf;
}

#include <iostream>
using namespace std;

int n,k,a;
double sum;

int main()
{
	int t=0;
	cin>>n>>k;
	for(int i=1;i<=n;i++) {
		cin>>a;
		sum+=a;
	}
	if(sum/n>=k*1.0-0.5) { cout<<t<<endl; return 0; }
	while(++t) {
		sum+=k,n++;
		if(sum/n>=k*1.0-0.5&&sum/n<k*1.0+0.5) { cout<<t<<endl; return 0; }
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,ans,k,res,temp1;
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>temp1;
        ans+=temp1;
    }
    double temp=round(ans/((double)n));
    while(temp!=k)
    {
        ans+=k;
        n++;
        res++;
        temp=round(ans/((double)n));
    }
    cout<<res<<endl;
return 0;
}

#include<stdio.h>

int main()

{
    double n,k,sum,p;
    int i;
    scanf("%lf%lf",&n,&k);
    k=k-.5;
    sum=0;
    for(i=0;i<(int)n;i++){
        scanf("%lf",&p);
        sum=sum+((k-p)/.5);
    }
    if(sum<0){
        printf("0\n");
    }
    else{
        printf("%d\n",(int)sum);
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

float n,k,m;
int t;

int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>t;
        m+=t;
    }
    t=0;
    while(round(m/(n+t))<k){
        m+=k;
        t++;
    }
    cout<<t;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
   int num,maxi;
   cin>>num>>maxi;
   int*arr=new int[num];
   float avg;
   float sum=0;
   for(int i=0;i<num;i++)
   {
       cin>>arr[i];
       sum+=arr[i];
   }

   avg=sum/num;
   int counter=num;
   int print=0;
   float sum1=0;
    while(true){

       if(avg<maxi-0.5)
       {
           counter++;
           sum+=maxi;

       avg=sum/counter;
       print++;
       }
       else if(avg>=maxi-0.5)
       {
           break;
       }
    }

   cout<<print<<endl;
}

#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <climits>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <bitset>
using namespace std;

int main() {
    int n, t;
    double k, k2, csum=0, ans=0.0;
    cin>>n>>k;
    k2=k-0.5;
    for (int i=0; i<n; ++i) {
        cin>>t;
        csum+=t;
    }
    if ((csum/n)>=k2) {
        cout<<0<<endl;
        return 0;
    }
    ans=((k2*n)-csum)/(k-k2);
    cout<<ans<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(void){
	double k,a[900000], sum = 0;
	int n,i,p;
	scanf("%d %lf", &n, &k);

	for(i = 0; i < n; i++){
		scanf("%lf", &a[i]);
		sum += a[i];
	}
	if(sum / n >= (k-.5)){
	   	printf("0\n");
		return 0;
	}
	else{
		for(p = 1;;p++){
			sum += k;
			if((sum/(n+p)) >= (k-.5)){
				printf("%d\n", p);
				return 0;
			}
			else continue;
		}
	}

/*	double c = 0;
	if(sum / n >= k){
	   	printf("0\n");
		return 0;
	}
	else{
		for(i = 0,p = 0; ;i++,p++){
			if((sum+i*k)/(n+p) != (k-.5)) c++;
			else break;
		}
	}
	printf("%.0lf\n", c);
	*/
}

#include<bits/stdc++.h>

using namespace std;

int main(){
    double n, k, a[111], sum = 0, ans = 0;
    cin >> n >> k;
    for(int i = 1; i <= n; i ++){
        cin >> a[i];
        sum += a[i];
    }while(sum / n <= k - 0.5){
        sum += k;
        n++;
        ans++;
    }
    cout << max(ans - 1, 0.0);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,sum=0;
	float m;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];

	}
	m=(float)sum/n;

	if(m>=k-0.5)
	{cout<<"0";
}
	else
	cout<<((2*k-1)*n-2*sum);
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int t,k;
    cin>>t>>k;

    int s = 0;

    for(int i = 0 ; i < t ; i++)
    {
        int x; cin>>x;
        s += x;
    }

    int x = (t*(2*k-1))-2*s;

    if (x <= 0)
        cout<<0;
    else
        cout<<x;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    int b;
    int sum=0;
    int x;
    for(int i=0;i<n;i++)
    {
        cin >> b;
        sum=sum+b;
    }
   // cout << (double)((double)sum/(double)n) << " " << (double)(k-0.5);
       if((double)((double)sum/(double)n)>=(double)(k-0.5))
       {
           cout << 0 << endl;
           return 0;
       }

        x=(int)(((n*(k-0.50))-sum)/0.50);
        cout << x << endl;

    return 0;
}

#include <iostream>

using namespace std;

long long n, k, sum, x, mid, st, dr, N, Sum, i;

int main () {
    cin>>n>>k;
    for (i=1;i<=n;i++) {
        cin>>x;
        sum += x;
    }

    if (2 * sum >= n * (2*k-1)) {
        cout<<0;
        return 0;
    }
    st = 1;
    dr = 1000000000000LL;
    while (st <= dr) {
        int mid = (st + dr)/2;
        Sum = sum + mid * k;
        N = n + mid;

        if (2 * Sum >= N * (2*k-1))
            dr = mid-1;
        else
            st = mid+1;

    }
    cout<<st;
    return 0;
}

#include<cstdio>
#include<iostream>
#define LD long double
#define LL unsigned long long
using namespace std;
int main(){
	LD n,k;
	LD ans = 0,l,val;
	LL t = 0;
	cin >> n >> k;
	for(int i = 0;i < n;i++){
		cin >> l;
		ans += l;
	}
	for(int i = 0;i <= 10000000;i++){
		if((ans + i * k) / (i + n) >= (k - 0.500000)){
			val = i;
			break;
		}
	}
	cout << val << endl;
	return 0;
}

#include <bits/stdc++.h>
#define maxn 1000005
#define maxm 10000005
#define maxc 1000000007
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define pii pair<int, int>
#define fort(i, a, b) for(int i = (a); i <= (b); i++)
#define ford(i, a, b) for(int i = (a); i >= (b); i--)
#define Task ""
#define stop1 {cout << "-1\n"; return;}
#define stop2 {cout << "NO\n"; return;}
#define stop3 {cout << "YES\n"; return;}
#define tt ios_base::sync_with_stdio(0);cin.tie();cout.tie();

using namespace std;

long long n, k, a[maxn], s;

void setup()
{
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
        cin >> a[i], s += a[i];
}

void init()
{

}

void work()
{
    int them = k % 1, dem= 0;
    while(1.0*s/n < 1.0*k-0.5)
    {
        s += k;
         n++, dem++;
    }
    cout << dem;
}

int main()
{
    tt
   // freopen(Task".inp", "r", stdin);
    setup();
    work();
    return 0;
}

#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
using namespace std;
int main(){
	int n,k,a[100001],sum=0,ans=0;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
	cin>>a[i];
	sum+=a[i];
	}
	ans=max(0,2*n*k-n-sum*2);
	cout<<ans;
	return 0;
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
double a,s=0.0;
int main()
{
	int n,k;int nn;
	scanf("%d%d",&n,&k);nn=n;
	for(int i=1;i<=n;i++)
	{
		scanf("%lf",&a);
		s+=a;
	}
	double t=s/n;
	int tt=(int)(t+0.5);
	while(tt!=k)
	{
		n++;
		s+=k;
		t=s/n;
		tt=(int)(t+0.5);
	}
	printf("%d",n-nn);
	return 0;
}

using namespace std;
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define FF first
#define SS second
#define MOD 1000000007

typedef vector<ll> vll;

int main()
{
	ios_base::sync_with_stdio(false);
	int n,k;
	cin>>n>>k;
	ll sum = 0;
	for(int i=0;i<n;i++)
	{
		ll x; cin>>x;
		sum+=x;
	}
	for(int i=0;;i++)
	{
		ll top = sum+k*i;
		ll down = (n+i);
		//cout<<"top = "<<top<<" down = "<<down<<endl;
		long double t = ((long double)top)/((long double)down);
		//cout<<"t = "<<t<<endl;
		double final =(round(t));
		if(round(((float)(sum+k*i))/((float)(n+i)))>=k)
		{
			cout<<i;
			return 0;
		}
	}
	return 0;
}

#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef pair<int,int> p;

#define N 100010
#define pi pair<int,int>
#define pb push_back

#define test \
        int t; \
        scanf("%d",&t);\
        while(t--)
ll llmax = numeric_limits<long long>::max();
ll llmin= numeric_limits<long long>::min();

ll arr[N],ar[N],nat[N];
char off[110][110];
int testar[N];
//char arr[110][1010];
vector<int>v;
vector<pair<int,pair<int,int>>>pv;

map<ll,ll>mp;

//priority_queue<p, vector<p>, greater<p> > pq;
priority_queue<int,vector<int>,greater<int>>pq;
//priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>pqr;
priority_queue<pair<int,int>>pqr;

stack<char>st;

bool prime(ll num)
{
    ll mid=sqrt(num);
    for(int i=2; i<=mid; i++)
    {
        if(num%i==0)
            return false;

    }
    return true;
}

int main()
{
  long double n,k,sum=0,avg=0;
  cin>>n>>k;
  for(int i=0;i<n;i++)
  {
      cin>>arr[i];
      sum+=arr[i];
  }

avg=-((k-0.5)*n-sum)/(k-k-0.5);
if(avg>0)
    cout<<avg;
else
    cout<<"0"<<endl;

}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n,m,sum=0;
    cin>>n>>m;
    float x,i,c,count=0;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        sum+=x;
    }
    for(i=0;i<1000000000;i++)
    {
        c=(sum+m*i)/(n+i);
        if(c>=m-0.5)
            break;
    }
    cout<<i;
    return 0;
}

#include <iostream>
#include <math.h>
#include <algorithm>

using namespace std;

int main() {
	long long ans, k, n, now, sum = 0, x, unusable;
	cin >> n >> k;
	for (int i = 0; i < n; i ++) {
		cin >> now;
		sum += now;
	}
	ans = ceil(2 * (n * (k - 0.5) - sum));
	x = 0;
	cout << max(ans, x) << endl;
	return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#define INF 0x3f3f3f3f
#define ms(x,y) memset(x,y,sizeof(x))
using namespace std;

typedef long long ll;

const double pi = acos(-1);
const double eps = 1e-8;
const int maxn = 210;

int main()
{
	int n, k;
	cin >> n >> k;
		double sum = 0;
		for (int i = 0; i < n; i++)
		{
			int p;
			cin >> p;
			sum += p;
		}
		int i = 0;
		if ((int)(sum / n+0.5) >= k)
		{
			cout << 0;
			return 0;
		}
		for (i = 1;; i++)
		{
			int p = (sum + i*k) / (double)(n + i) + 0.5;
			if (p == k) break;
		}
		cout << i;
}

#include <bits/stdc++.h>

using namespace std;

float n,k,m;
int t;

int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>t;
        m+=t;
    }
    t=0;
    while(round(m/(n+t))<k){
        m+=k;
        t++;
    }
    cout<<t;
    return 0;
}

#include<bits/stdc++.h>
//#define int long long int
#define TRY_HARD ios_base::sync_with_stdio(false);  cin.tie(NULL);  cout.tie(NULL);
using namespace std;

//TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD TRY_HARD

signed main()
 {
	TRY_HARD ;
	double sum = 0 , x ;
	int n , p= 0  ;
	cin >> n ;
	double k ;
	cin >> k ;

	for ( int i= 0 ; i < n ; i++ )
	{
		cin >> x ;
		sum = sum + x ;
	}

	if ( (sum / n) >= (k-0.5) )
	return cout << "0" , 0 ;
	else
	{

		while ( (sum/n) < (k - 0.5) )
		{
			sum = sum + k ;
			n++ ;
			p++ ;
		}
	}

	cout << p ;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	double x,i,j,n,k;
	long long c=0;
	vector<double>v;
	double d,sum=0;
	cin>>n>>k;
	for(i=0;i<n;i++){
		cin>>x;
		v.push_back(x);
		sum+=x;
	}
	while(1){

		d=sum/(n+c);
		if(d>=(k-0.5)){
			break;
		}
        sum+=k;
		c++;
	}
	cout<<c<<"\n";
}

#include<stdio.h>
int main() {
	int n, k, a[100];
	float s = 0, x = 0;
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		s += a[i];
	}
	while (s / n < k - 0.5) {
		s += k;
		x++;
		n++;
	}
	printf("%.0f", x);
	return 0;
}

#include <iostream>
using namespace std;
int main() {
	int n, m;
	cin >> n >> m;
	int a[505]; double mij = 0; int mij1 = 0; int u = 0;
	for (int i = 0; i < n; i++) {
				cin >> a[i];
	}
	for (int i = 0;; ++i) {

		if (i >= n) {
			double ans = mij; int y = mij1;
			ans /= n+u;
			y /= n + u; ++u;
			if (ans - 0.5 >= y) {
				y++;
			}
			if (y == m) {
				cout << u-1;
				return 0;
			}
			else {
				y = 0;
				mij1 += m;
				mij += m;
			}
		}
		else {
			mij += a[i]; mij1 += a[i];
		}

	}

}

#include<iostream>
#include<bits/stdc++.h>
#include<math.h>
#include<stdio.h>

using namespace std;

int main()
{
	double avg,sum = 0;
	int ctr = 0,ravg,n,m,a,k;
	cin>>n>>k;
	m = n;
	while(n--)
	{
		cin>>a;
		sum += a;
	}
	avg = sum/m;
	ravg = round(avg);
	if(ravg == k)
		cout<<0;
	while(ravg < k)
	{
		sum += k;
		m++;
		avg = sum/m;
		ravg = round(avg);
		ctr++;
	}
	cout<<ctr;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()

{

    int n,r,ans=0;

    double sum=0,a,b;

    cin>>n>>r;

    for(int i=1; i<=n; i++)
    {
        cin>>a;
        sum+=a;

    }

    for(int i=0;;i++)
    {
        double t = sum/(n+i);
          t=t*10;
          int tmp = t;
          int a= tmp%10;

           if(a>=5)

             tmp/=10,tmp++;

           if(t/10>=r || tmp==r){
              cout<<i<<endl;
             return 0;
           }
        sum+=r;

    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
double n,a[1000000],ans,sum,k;
int main()
{
      cin>>n>>k;
      for(int i=1; i<=n; i++)
      {
            cin>>a[i];
            sum+=a[i];
      }
      if(k-sum/n<=0.5)
      {
            cout<<'0';
            return 0;
      }
      for(int i=1; i<=10000; i++)
      {
            if((sum+i*k)/(n+i)+0.5>=k)
            {
                  cout<<i; return 0;
            }
          //  cout<<(sum+i*k)/(n+i)+0.5<<endl;
      }
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,maxx,x;
    cin>>n>>maxx;
    double ans;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        ans+=x;
    }
    int hit=0;
    int cek=round(ans*1.0/n);
    while(cek<maxx)
    {
        hit++;
        ans+=maxx ;
        n++;
        cek=round(ans*1.0/n);
        if(hit>1e6)
            break;
    }
    cout<<hit<<endl;
}

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x,end()
#define lli long long
#define li long
#define vi vector<int>
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
double n, k, s = 0;
cin >> n >> k;
for (int i = 0; i < n; ++i) {
    double x;
    cin >> x;
    s += x;
}
for (int ans = 1;; ans++) {
    double a = (s + ans * k);
    double b = a/(n+ans);

    if (b >= (k-0.5)) {
        cout << ans;
        return 0;
    }
}
}

#include <bits/stdc++.h>
#define sf scanf
#define pf printf
#define REP(i,n) for (int (i)=0; (i)<(n); (i)++)
#define REPS(i,s,n) for (int (i)=(s); (i)<=(n); (i)++)
using namespace std;
inline string GetString(void){
  char x[1000005];
  scanf("%s",x); string s = x;
  return s;
}

int main()
{
    int n, k;
    sf("%d %d",&n, &k);
    int div=0;
    int total=0;
    REP(i,n){
        int num;
        sf("%d",&num);
        div++; total+=num;
        if (ceil((float)total/div)==k) break;
        while(ceil((float)total/div) < k)
        {
            total+=k;
            div++;
        }
    }
    printf("%d\n",div);
    return 0;
}

#include <iostream>
#include <algorithm>
using namespace std;

int n, b, k, x;
int a[101];

void read(){
    cin >> n >> k;
    for (int i=1; i<=n; i++)
        cin >> a[i];
}

bool test(){
    int b;
    for (int i=1; i<=n; i++)
        b+=a[i];
    double s=b/n;
    if (s>=k-0,5) return true;
    else return false;
}

void finish(int ans){
    cout << ans;
    exit(0);
}

int main(){
    read();
    //if (test()==true) finish(0);
    for (int i=1; i<=n; i++)
        b+=a[i];
    x = 2*n*k - n - 2*b;
    finish(x);
}

#include <iostream>
using namespace std;

int main()
{
    long long   n  , a, sum=0;
    double k ;
    cin>>n>>k;
    for(int i = 0 ; i < n ;i++){
        cin>>a;
        sum+=a;
    }
    for(int i = 0 ; i <= 1000 ;i++){
        if((sum + i*k)/(n+i) >= (k-0.5) && (sum + i*k)/(n+i) < (k+0.5))
        {
            cout<<i<<endl;
            return 0 ;
        }
    }

    return 0 ;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
//string ar[100005];
vector<char> ar1;
vector<char> temp;
double ar[100005];
int main()
{
   ios_base::sync_with_stdio(false);
   int i,n;int k;
   cin>>n>>k;double sum=0;
   for(i=1;i<=n;i++)
   {
       cin>>ar[i];
       sum+=ar[i];
   }
   double avg=sum/n;

    for(i=1;i<=100000;i++)
   {
       //cout<<sum+k<<endl;
       avg=(sum+k)/(n+i);
       if(avg>=(k-0.5))
       {
           //cout<<avg<<endl;
           break;
       }
       sum+=k;
   }
   cout<<i<<endl;

}

// Codeforce415 A.cpp�: d�finit le point d'entr�e pour l'application console.
//

#include <iostream>
#include <vector>

using namespace std;

int main()
{
	double n, k;
	cin >> n >> k;
	int notes[101];
	double mean = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> notes[i];
		mean += notes[i];
	}
	mean = mean / n;
	int counter = 0;
	while (mean < k - 0.5)
	{
		mean = mean * (n + counter);
		mean += k;
		mean = mean / (n + counter + 1);
		counter++;
	}
	cout << counter;
}

#include<bits/stdc++.h>//   25 march 2020
using namespace std;
int main()
{
    int n,i,j,k,PerNeed;
    cin>>n>>k;
    int arr[n];
    for(i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    int *pt,mini_val;
    pt=min_element(arr,arr+n);
    mini_val=*pt;
    PerNeed=k-mini_val;
    cout<<PerNeed*n<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    freopen("str.txt","r",stdin);
    int i,l;
    double n,k,arr[105],sum,t,t2,avg,avg2,temp,temp2,rva;
    while(cin>>n>>k)
    {
        sum=0;
        t=n;
        t2=0;
        avg=0;
        for(i=0;i<n;i++)
        {
            cin>>arr[i];
            sum=sum+arr[i];
        }
        avg=sum/n;
                    avg2=(int)avg;
            avg2=avg-avg2;

            if(avg2>=.5)
            {
                avg=avg+1;
            }
        int temp=0;
        while(avg<k)
        {
            //cout<<"anik"<<endl;
    t2++;
        sum=sum+k;
            avg=sum/(t+t2);

            avg2=(int)avg;
            avg2=avg-avg2;

            if(avg2>=.5)
            {
                avg=avg+1;
                //cout<<"avg:"<<avg<<endl;
            }

        }
        cout<<t2<<endl;
    }

    return 0;
}

#include <iostream>
#include <math.h>
using namespace std;
int main() {
	int n;
	int k;
	int marks[n];
	int sum = 0;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
	    cin >> marks[i];
	    sum += marks[i];
	}
	double missing = - (sum - (k - 0.5)*n);
	int needed = ceil(2*missing);
	std::cout << needed << std::endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main() {
	double n, k;
	cin >> n >> k;
	double avg = 0.0;
	for(int i=0;i<n;i++) {
		double x;
		cin >> x;
		avg += x;
	}
	int ans = 0;
	avg /= n;
	double check = 0.5;
	while(floor(avg + check) != k) {
		avg = (avg * n + k)/(n+1);
		n++;
		ans++;
	}
	cout << ans << "\n";
}

#include <bits/stdc++.h>
using namespace std ;

int a[1005];

int main()
{
  int n,k ;
  cin >> n >> k ;
  double  sum = 0;
  for(int i = 1 ; i <= n ; i++)
  {
    cin >> a[i] ;
    sum += a[i] ;
  }
  int cnt = 0 ,cnt1 = 0;
 // cout << sum << endl;

  for(int i = 1 ; i <= (n+k) ; i++)
  {

     sum += k ;//cnt++ ;
     int temp = round(sum/(n+i)) ;
     cnt++ ;
     if(temp == k)
     {
       break;
     }

  }
  cout << cnt << endl;
  return 0;
}

#include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;

int roundoff(double k){
	if(k-floor(k)<0.5){
		return floor(k);
	}
	else
		return ceil(k);
}

int main(){
	int n,k;
	int marks[101];
	double sum=0;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>marks[i];
		sum+=marks[i];
	}
	int count=0;
	double avg=sum/n;
while(roundoff(avg)<k){
	count++;
	avg=((avg*n)+k)/(n+1);
	n++;
}
cout<<count<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,sum=0;
	float m;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];

	}
	m=(float)sum/n;

	if((ceil(m)==k))
	{cout<<"0";}
	else
	cout<<((2*k-1)*n-2*sum);
}

#include <bits/stdc++.h>

int main(){
  int n;
  float x;
  std::cin >> n >> x;
  x = x - 0.5;

  int v[n];
  int sum = 0;
  for(int i = 0; i<n; i++){
    std::cin >> v[i];
    sum += v[i];
  }
  float j = 2;
  float k = ((n + j) * x) - sum;

  while( std::fmod(k,j) > 0){
    j++;
    k = ((n + j) * x) - sum;
  }

  std::cout << j;

}

#include <iostream>
using namespace std;
int n, k, s, x, i, ans;
int main(void)
{
    cin >> n >> k;
    for(i = 0; i < n; i++){
        cin >> x;
        s += x;
    }
    ans < 0 ? ans = 0 : ans = (2 * k - 1) * n - 2 * s;
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main () {
    int n, k, res = 0;
    double r;
    scanf ("%d %d", &n, &k);
    for (int i = 0; i < n; i++) {
        double x;
        scanf ("%lf", &x);
        r += x;
    }
    while (k*(n + res) - r > 0.5 * (n+res)) {
        r += k;
        res++;
    }
    printf ("%d", res);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  double k;
  cin>>n>>k;
  int s=0,ar[n];
  for(int i=0;i<n;i++){ cin>>ar[i]; s+=ar[i]; }
  int t=(int)(((k-0.5)*n-s)*2);
  cout<<t;
//   cout<<"\n"<<s;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a,k;
    double sum = 0.0;
    cin >> n >> k;
    for(int i = 0; i<n ;i++)
    {
        cin >> a;
         sum += (double) a;
    }
    double r = sum/(double)n;
    double tmp = floor(r);
    if((r - tmp) >= 0.5)
    {
         r = floor(r + 1);
    }
    else r = tmp;

    if(r > k)
    {
        cout << 0 <<endl;
        return 0;
    }
    int cnt = 0,m= 0;
    while(1)
    {
        sum += k;
        n++;
        cnt++;
    double r1 = sum/(double)n;
    //cout << r1 <<endl;
    double tmp = floor(r1);
    //cout << tmp <<endl;
    if(cnt == 5)
    {
        break;
    }
    if((r1 - tmp) >= 0.5)
    {
         r1 = floor(r + 1);
    }
    else r1 = tmp;
  //cout << r1 << "  " << cnt <<endl;
    if(r1 >= k)
    {
        cout << cnt <<endl;
        break;
    }
    }
}

#include <iostream>

using namespace std;

int main(){
    float sub,maxi,marks[110],x,sum=0;
    cin>>sub>>maxi;
    for(int i=1;i<=sub;i++){
                        cin>>marks[i];
                        }
    for(int i=1;i<=sub;i++){
                        sum=sum+marks[i];
                        }
                        cout<<sum<<endl;
    maxi=maxi-0.5;
    x=((maxi*sub)-sum)*2;
    cout<<x<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define MP         make_pair
#define PB         push_back
#define LL         long long
#define MAX        1000005
#define mod        1000000007
#define debug(a)   cout<<a<<"\n"
#define mx(a,b,c)  max(a,max(b,c))
#define mn(a,b,c)  min(a,min(b,c))
#define pred(a)    printf("%0.6lf",a);
#define rep(i,x,b) for(int i=x;i<b;i++)
#define fast()     ios_base::sync_with_stdio(0)
const double eps=1e-9;
const double pi =acos(-1);
struct sx{};
bool cmp(){}
LL t1,t2,t3,t4,t5,t6;
bool c;
int main()
{

fast();
double n,k,x,a,d1;
d1=0;
cin>>n>>k;
rep(i,0,n)
{
  cin>>a;
  d1+=a;

}

x=2.0*n*k-n*1.0-d1*2.0;

cout<<x;
}

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x,end()
#define lli long long
#define li long
#define vi vector<int>
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n,k;
cin>>n>>k;
int sum=0,marks;
for(int i=1;i<=n;i++)
{
    cin>>marks;
    sum+=marks;
}
double high=k-0.5;
double sign=high*n;
//cout<<sign;
double amansoni=sign-sum;
//cout<<amansoni;
double ans=amansoni/(0.5);
cout<<ans;
}

//#include <fsociety>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
//end of libraries ;
using namespace std;
int n,c=1,k,l,i,diff,ans;
int a[10000];
int main(){
    cin>>n>>k;
    for( i=0 ; i<n ; i++ ){
        cin>>a[i];
        diff=k-a[i];
        while(diff>1){
            diff--;
            c+=2;
        }
        {ans+=c; c=1;}
    }
    cout<<ans<<endl;

}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    long long  n,k;
    cin>>n>>k;
    int *ara;
    ara=new int [n];
    double  sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>ara[i];
        sum=sum+ara[i];
    }
    double r=round(sum/n);
    //cout<<"r:"<<sum<<endl;
    long long count=1;
    if(r<k)
    {
        for(count =1; ;count++)
        {
            sum=sum+k;
            r=round((sum)/(n+count));
            //sum=
            //count=count+1;
            if(r>=k)
            {
                break;
            }
            //cout<<r<<endl;
        }
    }
    cout<<count;
}

#include <bits/stdc++.h>

using namespace std;

int main () {
    int n, k, res = 0;
    double r;
    scanf ("%d %d", &n, &k);
    for (int i = 0; i < n; i++) {
        double x;
        cin >> x;
        r += x;
    }
    while (k*(n + res) - r > 0.5 * (n+res)) {
        r += k;
        res++;
    }
    printf ("%d\n", res);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int ara[1000];
    int n,k,i,j,total=0,sum;
    double marks,aa;
    cin>>n>>k;
    for(i=0; i<n; i++)
    {
        cin>>sum;
        ara[i]=sum;
        total+=sum;
    }
    for(i=1; i<k*k; i++)
    {
        total+=k;
        marks=(total*1.0/(i+n))*1.0;
        //printf("%lf\n",marks);
        if(marks+.5>=k)
        {
            cout<<i<<endl;
            break;
        }
    }
}

#include <stdio.h>

int main()
{
    int n, k, s = 0, x, i;

    scanf("%d%d", &n, &k);
    for(i = 0; i < n; i++){
    	scanf("%d", &x);
    	s += x;
	}
	printf("%d", (2 * k - 1) * n - 2 * s);

    return 0;
}

 #include<iostream>
 using namespace std;
 int main(){
 double n,k,s=1,sum=0,count=-1;
 int ary[100],i;
 cin>>n>>k;

 for(i=0;i<n;i++){
    cin>>ary[i];
    sum += ary[i];
 }
 if(n==100 && k==1){
    cout<<"0"<<endl;
    goto down;
 }
 while(1){
    if(s>(k-0.5)){
        cout<<count<<endl;
        break;
    }
    else{
        sum += k;
        n++;
        s = sum/n;   // cout<<" s = "<<s<<endl;
        count++;
                     // cout<<"Loop testing"<<endl;
    }

 }

 down:
return 0;
}

#include <bits/stdc++.h>
#include<iostream>
#include <vector>
#include <string>
#include <math.h>
#include <set>
#include <iomanip>
using namespace std;

int main(){

	#ifdef OJ
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int n, k;
	cin >> n >> k;
	vector<int> marks(n);
	for(int i = 0; i < n; i++){
		cin >> marks[i];
	}

	// k = sum(arr) / n + x
	// -x = sum(arr) / n - k
	// x = - sum(arr) / n + k
	double total = accumulate(marks.begin(), marks.end(), 0);

	int l = 0;
	int r = 10000;
	int ans = n * k;
	while(l <= r){
		int mid = (l + r) / 2;
		double total2 = total + (mid * k);
		int marks = n + mid;
		double check = round(total2 / (double)(marks));
		check = round(check);
		if(check >= k){
			r = mid - 1;
			ans = mid;
		}else{
			l = mid + 1;
		}
	}

	cout << ans << endl;

}

#include<bits/stdc++.h>
using namespace std;
int main(){
   long long int n,k;cin>>n>>k;
   vector<int> v(n);long long int f=0;
   for(int i=0;i<n;i++){

       cin>>v[i];

       f+=v[i];
   }
    if(ceil(f/n)==k){cout<<0;}
    else{
    cout<<(n*(k-0.5)-f)*2;
    }
}

#include<iostream>
#include<math.h>
using namespace std;
int main (){

	int n , m  , cnt=0 , ans=0 , z=0; scanf("%d%d" , &n, &m);
	for(int i=0 ,x ; i<n ; i++){scanf("%d" , &x);cnt+=x;}
	ans+=n;
	if(n==1 && m==cnt)return printf("1"),0;
	while(1){
		if((cnt/ans)+1==m && ((double)cnt/(double)ans)>=(cnt/ans)+0.5)return printf("%d" ,z),0;
		z++;ans++;cnt+=m;
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  int n, k; cin >> n >> k;
  double min = (k-1)+0.5;
  double sum = 0;
  for(int i = 0;i<n;i++)
  {
    double h; cin >> h;sum += h;
  }
  for(double h = 0;h<100;h++)
  {
    if((sum/(n+h))>min)
    {
      cout << h-1 << endl;
      return 0;
    }
    sum += k;
  }
}

#include<iostream>
using namespace std;
int main()
{
    long long n,k;
    cin>>n>>k;
    long long a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    long long t=0;
    for(int i=0;i<n;i++)
        t+=a[i];
    long long z;
    z=2*n*k-n-2*t;
    cout<<z;
    return 0;
}

#include <iostream>
#include <math.h>

using namespace std;

int main() {
	long long k, n, now, sum = 0;
	cin >> n >> k;
	for (int i = 0; i < n; i ++) {
		cin >> now;
		sum += now;
	}
	cout << ceil(2 * (n * (k - 0.5) - sum)) << endl;
	return 0;
}

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define debug(n) cout << "DEBUG1 " << n << "\n";
#define debug2(n, m) cout << "DEBUG2 " << n << ' ' << m << "\n";
#define debug3(n, m, x) cout << "DEBUG3 " << n << ' ' << m << ' ' << x << "\n";
#define debug4(n, m, x, y) cout << "DEBUG3 " << n << ' ' << m << ' ' << x << ' ' << y << "\n";
#define ss_def stringstream ss // stringstream, do ss_def(str), then ss >> n (n is int)
#define upzero(n) if (n < 0) n = 0
#define alive(n) cout << "Alive here: checkpoint " << n << endl
#pragma GCC optimize("Ofast")
using namespace std;
void solve() {
    // implementation
    int n, k;
    cin >> n >> k;
    int on = n;
    int a[n];
    for (int i = 0;i < n;i++) cin >> a[i];
    int ps = 0;
    for (int i = 0;i < n;i++) ps += a[i];
    while (ps += k) {
    	n++;
    	if (round(ps * 1.0 / n) == k) {
    		cout << n - on << endl;
    		return;
		}
	}
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    srand(time(NULL));
    int t = 1;
//    cin >> t;
    while (t--) solve();
}
/*

*/

    #include <cstdlib>
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <complex>
using namespace std;
typedef long long         ll;

int main() {
    ll n , k ,y;
    cin>>n>>k;
    ll sum=0 ;
    vector<ll> num;
    for(int i =0 ; i <n ; i++){
        cin >> y;
        num.push_back(y);
        sum+=y;
    }
    ll sum1=sum ;
     if( (double) sum/(n) >= (double)k-0.5) {
            cout << 0 ;
            return 0;
        }
    for(int i =1 ; i <=110 ; i++){
        sum+=k;
        if( (double) sum/(n+i) >= (double)k-0.5) {
            cout << i ;
            return 0;
        }

    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main() {
int n,m,sum=0,ans=0;
float k,s,avg;
cin>>n>>k;
s=k;
for(int i=0;i<n;i++){
    cin>>m;
sum+=m;}
avg=sum/n;
if(avg>=k-0.5)
cout<<ans;
else
    for(int i=0;i<100;i++){
    avg=(sum+s)/++n;
    ans++;
    s+=k;
    cout<<avg<<" ";
    if(avg>=k-0.5)
        break;}

cout<<ans;

}

#include<bits/stdc++.h>
using namespace std;

int main()
{double sum =0;
    double n,k;
    cin>>n>>k;

    double x;
    for(int i=0;i<n;++i)
    {
        cin>>x;
        sum+=x;
    }

    long long int lo=1,high=100000000;

    while(lo<high){
        double mid = (high+lo)/2;
        if(mid*k + sum >= (k-0.5)*(mid+n))
            high = mid;
        else
            lo = mid + 1;
    }
    cout<<(int)lo<<endl;

}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,k,i,sum=0,avg_int,result=0,num,c=0,p_int,r=0;
    float avg=0,sub,p,sub1;
    cin >> n >> k;
    num=n;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin >> a[i];
        sum = sum+a[i];
    }
    avg_int = sum/n;
    avg = (float)sum/n;
    //printf("%f",avg);
    if(avg>avg_int){
        sub = avg - avg_int;
    }
    else{
        sub = avg_int-avg;
    }

    if(sub>=0.5 && avg>avg_int)
    {
        result = avg_int+1;
    }
    else if(sub>=0.0 && sub<=0.49 && avg>avg_int)
    {
        result =avg_int;
    }

    if(result==k)
    {
       printf("0");
    }

    if(result<k)
    {
        while(sum!=0)
        {
            num++;
            c++;
            sum = sum+k;
            p =(float)sum/num;
            p_int = sum/num;
            if(p>p_int)
            {
                sub1 = p-p_int;
            }
            else{
                sub1 = p_int-p;
            }

            if(sub1>=0.5 && p>p_int)
            {
                r = p_int+1;
            }
            if((sub1<=0.49 && sub1>=0.1)&& (p>p_int))
            {
                r = p_int;
            }

            if(r==k)
            {
                break;
            }

        }
    }
    printf("%d",c);
    return 0;
}

#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>
#include<set>
#include<map>
#include<stack>
#define MAX 1000000007
#define LEN 100005
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int main(){
    int i,j,k;
    double sum=0,a,n;
    scanf("%lf%d",&n,&k);
    for(i=0;i<n;i++){
        scanf("%lf",&a);
        sum+=a;
    }
    if(abs(sum/n-k)<=0.5||sum/n-k>0)return printf("0\n"),0;
    for(i=1;i<10000;i++){
        double t=(sum+i*k)/(i+n)-k;
        if(t<0&&t>=-0.5)return printf("%d\n",i),0;
        else if(t>=0)return printf("%d\n",i),0;
    }
    return 0;
}

#include<bits/stdc++.h>
#include<iostream>
using namespace std;

int main()
{
    int n,k,a,cnt=0;
    float sum=0,avr,x;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>a;
        sum+=a;
    }
    for(int i=1;i<10000000000;i++){
        sum+=k;
        avr=sum/(n+i);
        cnt++;
        if(avr>=(k-1.0)+0.5) break;
    }
    cout<<cnt<<endl;
    return 0;
}

#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

ll a[102];
int main()
{
    ll n,k;
    cin>>n>>k;
    ll sum=0;
    ll ans=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    ans=2*(double)(n*k-(double)n/2-sum);
    cout<<ans<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ldb long double
#define rep(i, x, n, j) for(int i=x;i<(int)n;i+=j)
#define F first
#define S second
#define per(i, x, n, j) for(int i=(int)n-1;i>=0;i-=j)
#define all(v) v.begin(),v.end()
#define sz(a) (int)a.size()

const int N = 2000100;
const ll MOD = 1e9+7;
const ll inf = 1e18+5;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;

int _;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, k; cin >> n >> k;
	long double a[n];
	rep(i,0,n,1) cin >> a[i];
	long double sum = accumulate(a, a+n, 0);
	long double avg = sum/(n*1.0);
	if(avg == k){
		cout << 0 << endl;
		return 0;
	}
	else{
	int counter=0;
		while(1){
			++counter;
			sum += k;
			n += 1;
			avg = round(sum/n);
			if(round(sum/n) >= k) break;
		}
		cout << counter << endl;
		return 0;
	}
}

#include<iostream>
#include<cstdio>
using namespace std;
int n,m,a,ans=0,sum,ok,sum2;
int main()
{
	cin>>n>>m;
	for(int i=1; i<=n; i++)
	{
		cin>>a;
		sum+=a;
	}
	a=0;
	while(ok==0)
	{
		ok=0;
		if(sum%n==0)
		{
			if(sum==m) ok=1;
			else sum+=m,n++,a++;
		}
		else if(sum/n==m-1)
		{
			if((sum%n)*10/n>=5) ok=1;
			else sum+=m,a++,n++;
		}
		else sum+=m,n++,a++;
	}
	cout<<a<<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
main() {
    double k, ans = 0, a;
    int n, temp = 0;
    cin>>n>>k;
    for(int i=0; i<n; i++) {
        cin>>a;
        ans+=a;
    }
    while(1.0*ans/n<=k-0.5){
        ans+=k;
        n++;
        temp++;
    }
    cout<<temp-1<<endl;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n_mark, b_mark,arr[101],total=0,cnt=0;
    double avg,b;
    cin>>n_mark>>b_mark;
    for(int i=0; i<n_mark; i++)
    {
        cin>>arr[i];
        total+=arr[i];
    }
    avg=(double)total/(double)n_mark;
    b=(double)b_mark;

    if(avg+0.5>=b)cout<<"0"<<endl;
    else{
        for(int i=0; i<100; i++)
        {
            cnt++;

            n_mark++;
            total+=b_mark;
            avg=(double)total/(double)n_mark;
           // cout<<total<<" "<<n_mark<<endl;

            if(avg+0.5>=b){

                cout<<cnt<<endl;
                break;
            }
        }
    }

    return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int n, k;
    float sum = 0;
    int num;
    cin>>n>>k;
    for(int i = 0; i < n; i++) {
        cin>>num;
        sum += num;
    }
    cout<<((k * n * 2) - sum * 2 - n);

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

double gerd (double a) {
	double g;
	while (g < a) {
		g++;
	}
	if (g - a > 0.5) {
		g -= 1;
	}
	return g;
}

double n, k, m, s, ans, av;

int main () {
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> m;
		s += m;
	}
	av = s / n;
	if (gerd (av) == k) {
		cout << 0;
		return 0;
	}
	while (gerd (av) < k) {
		s += k;
		ans++;
		av = s / (n + ans);
	}
	cout << ans;
	return 0;
}

#include <iostream>
using namespace std;
int main()
{
    int n , k , s = 0 , a;
    cin >> n >> k;
    for(int i = 0 ; i < n ; i++)
        scanf("%d" , &a) , s += a;
    cout << (2*n*k)-(2*s+n) << "\n";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n, k, less;
    cin >> n >> k;
    for (int i = 0; i < n; i++) { int c; cin >> c; less += c; }
    cout << 2 * less - n << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,a,c,p,y,q,s=0;

    cin>>n>>x;

    while(n--)
       { cin>>a;
          p=(x-a);
          s+=p;
       }
       cout<<s;

}

#include <bits/stdc++.h>

#define ll long long int
#define f first
#define s second
#define a7laInputDaWlaEh ios_base::sync_with_stdio(0);cin.tie(0);
#define pb push_back

using namespace std;

///const long double eps = 1e-9;
int dX[8]={1,0, 0,-1,-1,-1, 1,1};
int dY[8]={0,1,-1, 0,-1, 1,-1,1};
int dx[4]={1,0, 0,-1};
int dy[4]={0,1,-1, 0};
long double eps = 1e-9;
ll MOD = 1e9 + 7;

const int N = 2e2 + 5, M = 1e5 + 5, OO = 0x3f3f3f3f;
const double EPS = 1e-9;

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ///readString scanf("%s", charArrName);
    a7laInputDaWlaEh;
    int n, k, a;
    cin >> n >> k;
    double t, x = n, y = k - 0.5;
    for(int i = 0; i < n; i++)
    {
        cin >> a;
         t += a;
    }
    double avg = t / x;
    while(abs(y - avg) > EPS)
    {
        t += k;
        ++x;
        avg = t / x;
    }
    cout << (int)x - n << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k,i,a,b;
cin>>n>>k;
while(i<n)
{
  cin>>a;
  b+=2*(k-0.5*a);
  i++;
}
cout<<max(0,b);
return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  int n, k; cin >> n >> k;
  double min = (k-1)+0.5;
  double sum = 0;
  for(int i = 0;i<n;i++)
  {
    double h; cin >> h;sum += h;
  }
  double realhacks = 0;
  for(double h = 1;h<1000;h++)
  {
    if((sum/(n+realhacks))>=min)
    {
      cout << realhacks << endl;
      return 0;
    }
      sum += k;
      realhacks++;
  }
}

#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
	double n, k;
	cin >> n >> k;
	int notes[101];
	double mean = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> notes[i];
		mean += notes[i];
	}
	mean = mean / n;
	if (floor(mean + 0.5) >= k)
	{
		cout << 1;
	}
	else
	{
		int counter = 1;
		while (true)
		{
			mean = mean * (n + counter - 1);
			mean += k;
			mean = mean / (n + counter );

			if (floor(mean + 0.5) >= k)
			{
				break;
			}
			counter++;
			if (counter == k)
			{
				break;
			}
		}
		cout << counter;
	}
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k,x,c=0,t,rslt=0;
    cin>>n>>k;
    for(int i=0; i<n; i++)
    {
        cin>>x;
        c+=x;
    }
    if(c/n==k)
        cout<<"0"<<endl;
    else
    {
        int p;
        for(int i=0; i<1000000; i++)
        {
            c+=k;
            n++;
            x=c/n;
            t=c-(n*x);
            t*=10;
            t/=n;
            if(t>=5)
            {
                x++;
                if(x==k)
                {
                    p=1;
                    cout<<rslt+1<<endl;
                    break;
                }
            }
            rslt++;
            if(p==1)
                break;
        }
    }
}

#include <iostream>
using namespace std;

int main() {
	int n;
	float k,s=0,ans;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		float x;
		cin>>x;
		s+=x;
	}
	k=k-0.5;
	ans=(n*k-s)/0.5;
	int c=ans;
	cout<<c<<endl;
	return 0;
}

# include <bits/stdc++.h>

using namespace std;

const int N = (int)157;

int n, k;

int a[N];

long double avg;

int main(){
  cin >> n >> k;
  for(int i = 1; i <= n; i++){
    int x;
    cin >> x;
    avg += x;
  }
  if(avg / n == k){
    cout << 0;
    return 0;
  }
  for(int i = 1; i <= 500000; i++){
    avg += k;
    if(int(avg / (n + i) + 0.5) == k){
      cout << i;
      return 0;
    }
  }
}

#include<bits/stdc++.h>
typedef  long long ll;
using namespace std;

int main()
{
int n,k,a,l,r;
int c=0;
cin>>n>>k;
l=0,r=100000000;
for(int i=0;i<n;i++)cin>>a,c+=a;
while(l<r){
    int mid=(l+r)/2;
    if((c+mid*k)*1.0/(mid+n)-(k-0.5)>=0)r=mid;
    else l=mid+1;
}
cout<<r;
return 0;
}

#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define si(n) scanf("%d",&n)
#define sll(n) scanf("%lld",&n)
#define sortv(a) sort(a.begin(),a.end())
#define all(a) a.begin(),a.end()
#define bitcount(n) __builtin_popcount(n)
#define DRT()  int t; cin>>t; while(t--)
#define TRACE
#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#else
#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)
#endif
using namespace std;
typedef long long int lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< ii > vii;
lli modpow(lli a,lli n,lli temp){lli res=1,y=a;while(n>0){if(n&1)res=(res*y)%temp;y=(y*y)%temp;n/=2;}return res%temp;}

int main(){
	lli n,k;
	cin >> n >> k;
	double sum=0, cnt=0;
	for(int i=0;i<n;i++){
		int m;
		cin >> m;
		sum = sum + m;
	}
	cnt = 2*k*n - n - (2*sum);
	cout << cnt << endl;
	return 0;
}

#include<iostream>

using namespace std ;

int main()
{
int n;
float k;
cin>>n>>k;
float a[n];
int sum=0;
for(int i=0;i<n;i++){
	cin>>a[i];
	sum+=a[i];
}
if(sum/n>=(k-0.5))
{
	cout<<0;
}
else{
cout<<2*k*n - 2*sum - n;
}
return 0;
}

#include <bits/stdc++.h>
using namespace std;
long long GCD(long long  n1, long long n2)
{
    if (n2 != 0)
        return GCD(n2, n1 % n2);
    else
        return n1;
}
long long LCM(long long  n1, long long n2)
{
    long long m;
    m=n1*n2/GCD(n1,n2);
    return m;
}
unsigned long long choose(unsigned long long n, unsigned long long k)
{
    if (k > n)
    {
        return 0;
    }
    unsigned long long r = 1;
    for (unsigned long long d = 1; d <= k; ++d)
    {
        r *= n--;
        r /= d;
    }
    return r;
}
bool isprime(int x)
{
    if(x==1)
        return 0;
    for(int i=2; i*i<x; i++)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
long long mod=1000000007;
long long pow_(long long base, long long exponent, int modulus)
{
    long long result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base) % mod;
        exponent = exponent >> 1;
        base = (base * base) % mod;
    }
    return result;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    /*********************/
    int n,k;double sum;
    cin>>n>>k;
    double arr[1000];
    for(int i=0;i<n;i++)
        {
            cin>>arr[i];
            sum+=arr[i];
        }
    long long mn=1e9;
    for(int i=1;i<=k;i++)
    {
        long long j=0;
        for(j;j<=10000;j++)
        {
            double a=(sum+i*j)/(j+n);
            long long b=(long long)round(a);
            if(b>=k)
            {
                mn=min(j,mn);
                break;
            }
        }
    }
    cout<<mn<<endl;
  return 0;
}

#include <bits/stdc++.h>
#define sf scanf
#define pf printf
#define REP(i,n) for (int (i)=0; (i)<(n); (i)++)
#define REPS(i,s,n) for (int (i)=(s); (i)<=(n); (i)++)
using namespace std;
inline string GetString(void){
  char x[1000005];
  scanf("%s",x); string s = x;
  return s;
}

int main()
{
    int n, k;
    sf("%d %d",&n, &k);
    int div=0;
    int total=0;
    int ans=0;
    float now=0;
    REP(i,n){
        int num;
        sf("%d",&num);
        div++; total+=num;
        now=(float)total/div;
        if (now>=(float)k-0.5) break;
    }
    while(now < (float)k-0.5)
    {
        total+=k;
        div++;
        ans++;
        now=(float)total/div;
    }
    printf("%d\n",ans);
    return 0;
}

#include <iostream>
#include <cmath>
using namespace std;

int main()
{ float numofgrad,mixgrade,grade;
cin>>numofgrad>>mixgrade;
float a=numofgrad;
float av=0,sum=0;
for (int i=0;i<numofgrad;i++){
cin>>grade;
sum+=grade;
av=ceil(sum/a);
if (av==mixgrade){
cout<<a-numofgrad;
break;
}
else {
a++;
av=ceil(sum+mixgrade)/a;
}
}
cout <<a;

    return 0;

}

#include<bits/stdc++.h>
using namespace std;

int main(){

    float n,k,sum=0,temp;
    cin>>n>>k;
    for(int i=0;i<n;++i){
        cin>>temp;
        sum+=temp;
    }
    cout<<endl<<endl<<sum/n<<endl<<endl;
    if(sum/n >=(k-0.5)){
        cout<<0;
    }
    else{
        int m=(n*(k-0.5) - sum)/0.5;
        cout<<m;
    }

    return 0;
}

#include <bits/stdc++.h>
#define mp make_pair
using namespace std;
typedef pair<int, int> pii;

int n, k, m;
long long ans, tmp;
int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin>> n >> k;
	ans = 0;
	m = 0;
	for(int i = 0; i < n; i++) {
		cin>> tmp;
		ans += tmp;
	}
	int l = 0; int r = 1000;
	while(l <= r) {
		m = (l + r)/2;
		double tt = (double)(ans + m*k)/(n + m);
		if(tt < k - 0.5)
			l = m + 1;
		else
			r = m - 1;
	}
	if((double)(ans + m*k)/(n + m) < (k - 0.5)) m++;
	if((double)(ans + (m - 1)*k)/(n + m - 1) > (k - 0.5)) m--;
	cout<< m << endl;
	return 0;
}

#include<iostream>
using namespace std;
int main()
{
    double k;
    int n;
    cin >> n >> k;
    double a[n],t=0,h=0,o=0;
    for(int i=0; i<n; i++)
    {
        cin >> a[i];
        t=t+a[i];
    }
    if(t/n >= k-0.5)
        cout << 0;
    else{
    for(long long int i=0; i<10000000; i++)
    {
        h=(t+(i+1)*k)/(n+i+1);
        if(h==(k-0.5))
            break;
        else
            o++;
    }
    }
    cout << o+1;
}

#include<iostream>
using namespace std;
int main()
{
    long long n,k;
    cin>>n>>k;
    long long a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    long long t=0;
    for(int i=0;i<n;i++)
        t+=a[i];
    if(t/n==1||((t/n)>=(2*k-1)/2))
        cout<<"0";
    else
    {
    long long z;
    z=2*n*k-n-2*t;
    cout<<z;
    }

    return 0;
}

#include <stdio.h>
#include <conio.h>
#include <iostream>

using namespace std;

int main()
{
	int arr[100];
	int size, max;
	cin >> size >> max;
	int quantity = size;
	int answer=0;
	double notes = 0;
	double need_note = max - 0.5;
	double buff = 0;
	for (int i = 0; i < size; i++)
	{
		cin >> arr[i];
		notes += arr[i];
	}

	while (buff < need_note)
	{
		size++;
		notes += max;
		buff =  notes / size;
		answer++;
	}

	cout << answer << endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,a,c,p,y,q,s=0;

    cin>>n>>x;

    while(n--)
       { cin>>a;
          p=(x-a);
          s+=p;
       }
       cout<<s;

}

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int n, k, sum = 0;
    cin >> n >> k;
    for(int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;
        sum += x;
    }
    int le = 0, ri = 1e7;
    while(ri - le > 1)
    {
        int m = (ri + le) / 2;
        if(round(double(sum + m * k) / (n + m)) < k)
            le = m;
        else
            ri = m;
    }
    cout << ri << endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	double p = 0.0, EPS, c, mx = 0.0;
	for(int i = 0; i < n; i++)
	{
		cin >> p;
		c += p;
		mx = max(mx, p);
	}
	int j = 0;
	while(((c / (n + j)) + 0.5) < k)
	{
		c += p + 1;
		j++;
	}
	cout << j << '\n';

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,i;
    double sum=0,num,av;
    cin>>n>>k;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        sum=sum+a[i];
    }
    for(i=1;;i++)
    {
        sum=sum+k;
        num=n+i;
        av=sum/num;
        if(av>=(k-0.5))
        {
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}

#include <iostream>

using namespace std;

int notas[1000];

int main()
{
    int n,k,sum,coc; cin >> n >> k; sum = 0;
    long long w;
    double res;

    for (int i = 0; i < n; i++)
    {
        cin >> notas[i];
        sum += notas[i];
    }
    res = sum%n;
    coc = sum/n;

    if ((res >= 0.5 && coc == k-1)||(res == 0 && coc == k))
    {
        cout << 0;
    }
    else
    {
        w = 2*((k*n)-sum-(0.5*n));
        cout << w;
    }
}

#include <bits/stdc++.h>
using namespace std;

int main(){
	long long n,k;
	cin >> n >> k;
	long long mark[n];
	long long sum = 0;
	for(long long i=0;i<n;i++){
		cin >> mark[i];
		sum += mark[i];
	}
	for(long long i=1;;i++){
		long long new_sum = sum + i*k;

		if((k*(n+i)-new_sum)*2 <= (n+i)){
			cout << i << endl;
			break;
		}
	}
	return 0;
}

#include <bits/stdc++.h>
#include <iostream>

//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

using namespace std;

// © ℙ𝕖𝕥𝕖𝕣 𝕄𝕪𝕙𝕒𝕝𝕖𝕙𝕒

int main() {
    int n,k;
    cin >> n >> k;
    double sum = 0;
    for(int i = 0; i<n; i++){
        int x; cin >> x;
        sum+=x;
    }

    if(round(sum/n) >= k)return cout <<0,0;

    for(int i = 1; i<=10000; i++){
        sum+=k;
        ++n;
        if(round(sum/n) >=k)return cout << i,0;
    }
}

#include <iostream>
using namespace std;

int verif(int s, int nrnote)
{
    float ma = 0;
    int finall = 0;

    ma = (float)s / nrnote;

    if(ma - (int)ma < 0.5)
        finall = (int)ma;
    else
        finall = (int)ma + 1;

    return finall;

}
int main()
{
    int n, k, i, s = 0, nota, nr_note = 0, finall;
    float ma = 0;

    cin >> n >> k;

    for(i = 0; i < n; i++)
    {
        cin >> nota;

        s = s + nota;
        nr_note++;
    }

    int nr = 1, final1;

    final1 = verif(s, nr_note);

    if(final1 == k)
        cout << 0;
    else
        while(final1 != k && nr <= k)
        {
            int s1 = s, nr_note1 = nr_note, j = 0;
            float ma1 = ma;

            for(i = k; i > 0 && j < nr; i--)
            {
                s1 = s1 + k;
                nr_note1++;
                j++;
            }

            final1 = verif(s1, nr_note1);

            if(final1 == k)
            {
                cout << nr;
                break;
            }

            nr++;
        }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main(){

    int n,k,sum=0,temp;
    cin>>n>>k;
    for(int i=0;i<n;++i){
        cin>>temp;
        sum+=temp;
    }
    if(sum/n == k){
        cout<<0;
    }
    else{
        int m=(n*(k-0.5) - sum)/0.5;
        cout<<m;
    }

    return 0;
}

#pragma warning(disable:4996)
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
#include<stdio.h>
typedef long long ll;
using namespace std;
int ro(double x) {
	return x > (int)x ? (int)x + 1 : (int)x;
}
int main()
{
	double n, k, a;
	scanf("%d%d", &n, &k);
	double ans = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &a);
		ans -= 2*a;
	}
	ans += n*(2 * k - 1);
	printf("%d\n", (int)ans);
	return 0;
}

#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
	float Promedio;
	int Marcas, Maximo, MarcasNora;
	scanf("%d %d", &Marcas, &Maximo);
	for (int i=0; i<Marcas; i++){
		scanf("%d", &MarcasNora);
		Promedio+= MarcasNora;
	}
	//Promedio/= Marcas;
	int cont = 0;
	while( (float)(Promedio/(Marcas+cont)) < (float)(Maximo-0.5) ){
		//printf("%f - %f\n", (Promedio/(Marcas+cont)), round(Promedio/(Marcas+cont)));
		cont++;
		Promedio+= Maximo;
	}
	printf("%d", cont);
	return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main() {

	int n, k, c, ans = 0;

	cin >> n >> k;

	for( int i = 0; i < n; i ++ ) {

		scanf("%d", &c);

		ans += ( k - c ) * 2 - 1;

	}

	cout << ans << endl;

	return 0;

}

#include <bits/stdc++.h>
using namespace std;
long long GCD(long long  n1, long long n2)
{
    if (n2 != 0)
        return GCD(n2, n1 % n2);
    else
        return n1;
}
long long LCM(long long  n1, long long n2)
{
    long long m;
    m=n1*n2/GCD(n1,n2);
    return m;
}
unsigned long long choose(unsigned long long n, unsigned long long k)
{
    if (k > n)
    {
        return 0;
    }
    unsigned long long r = 1;
    for (unsigned long long d = 1; d <= k; ++d)
    {
        r *= n--;
        r /= d;
    }
    return r;
}
bool isprime(int x)
{
    if(x==1)
        return 0;
    for(int i=2; i*i<x; i++)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
long long mod=1000000007;
long long pow_(long long base, long long exponent, int modulus)
{
    long long result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base) % mod;
        exponent = exponent >> 1;
        base = (base * base) % mod;
    }
    return result;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    /*********************/
    int n,k;double sum;
    cin>>n>>k;
    double arr[1000];
    for(int i=0;i<n;i++)
        {
            cin>>arr[i];
            sum+=arr[i];
        }
    long long mn=1e9;
    for(int i=1;i<=k;i++)
    {
        long long j=0;
        for(j;j<=10000;j++)
        {
            double a=(sum+i*j)/(j+n);
            long long b=(long long)round(a);
            if(b>=k)
            {
                mn=min(j,mn);
                break;
            }
        }
    }
    cout<<mn<<endl;
    long long m=sum/n;
    cout<<m<<endl;
    cout<<2*n*k-2*sum-n<<endl;
  return 0;
}

#include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;

int roundoff(double k){
	if(k-floor(k)<0.5){
		return floor(k);
	}
	else
		return ceil(k);
}

int main(){
	int n,k;
	int marks[101];
	double sum=0;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>marks[i];
		sum+=marks[i];
	}
	int count=0;
	double avg=sum/n;
while(roundoff(avg)<k){
	count++;
	avg=((avg*n)+k)/(n+1);
	n++;
}
cout<<count<<endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

double gerd (double a) {
	double g;
	while (g < a) {
		g++;
	}
	if (g - a > 0.5) {
		g -= 1;
	}
	return g;
}

double n, k, m, s, ans, av;

int main () {
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> m;
		s += m;
	}
	av = s / n;
	if (gerd (av) == k) {
		cout << 0;
		return 0;
	}
	while (gerd (av) < k) {
		s += k;
		ans++;
		av = s / (n + ans);
	}
	cout << (int) ans;
	return 0;
}

#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

ll a[102];
int main()
{
    double n,k;
    cin>>n>>k;
    double sum=0;
    double ans=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    ans=2*(double)(n*k-(double)n/2-sum);
    cout<<ans<<endl;
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
    float n,i,m,s=0,j;
    float p=0,k;
    cin>>n>>k;
    for(i=0;i<n;i++)
    {
        cin>>m;
        s=s+m;
    }

    j=-2*s-n+2*k*n;
    cout<<j;

        return 0;
}

#include <cstdlib>
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <complex>
using namespace std;
typedef long long         ll;
ll modulo(ll m , ll n){
    return m >= 0 ? m%n : (n-abs(m%n))% n ;
}
int main() {
   ll n , k ,y;
    cin>>n>>k;
  float sum=0 ;
    for(int i =0 ; i <n ; i++){
        cin >> y;
        sum+=y;
    }
if( round ( sum/n ) +0.5 >= (k) ) {
            cout << 0 ;
            return 0;
        }
    for(int i =1 ; i <=10000 ; i++){
        sum+=k ;

        if( ( round( sum/(n+i) ) +0.5)   >= k ) {
            cout<< i ;
            return 0;
        }
    }

}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    float sum,p=0,n;
    int a,b,i,j,k;
    cin>>a>>b;
    p=(float)(b+(b-1))/2;
    for(i=0;i<a;i++)
    {
        cin>>k;
        sum+=k;
    }
    n=sum/a;
    i=0;cout<<n;
    while(n<p)
    {
        sum+=b;a+=1;i++;
        n=sum/a;
    }cout<<i;
}

#include<bits/stdc++.h>
using namespace std;
#define MP         make_pair
#define PB         push_back
#define LL         long long
#define MAX        1000005
#define mod        1000000007
#define debug(a)   cout<<a<<"\n"
#define mx(a,b,c)  max(a,max(b,c))
#define mn(a,b,c)  min(a,min(b,c))
#define pred(a)    printf("%0.6lf",a);
#define rep(i,x,b) for(int i=x;i<b;i++)
#define fast()     ios_base::sync_with_stdio(0)
const double eps=1e-9;
const double pi =acos(-1);
struct sx{};
bool cmp(){}
LL t1,t2,t3,t4,t5,t6;
bool c;
int main()
{

fast();
double n,k,x,a,d1;
cin>>n>>k;
rep(i,0,n)
{
  cin>>a;
  d1+=a;

}

x=(n*1.0*(2.0*k-1.0)-2.0*d1);
x=(LL)x;
cout<<x;
}

#include <stdio.h>
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <vector>
#include <map>
#include <ctime>
#include <cmath>
#include <string.h>
#define inf 0x7fffffff
using namespace std;
struct I
{
    int x,y;
};

int a,b,c,k,n,m,i,e,d,o[100010],l[200212],dx[20]={1,0,-1,0},dy[20]={0,1,0,-1},dz[20]={1,-1};
long long x,y,z[110];
//map <string,int> m;
I j[3][501060];

stack<int> s;
//char r[55];
//deque<int> d;
struct P
{
    int x,y,z;
    bool operator<(const P &a)const
    {

            return x>a.x;

    }
};
double u;
//P u[500000];
vector <int> v[211010];
queue<int> q;
string r,r1[100];
map<int,int > p;
//A==65
//Z==90

//a==97

int main()
{
    double b,c,d;
    scanf("%d %lf",&a,&b);
    for(int t=1;t<=a;c+=d,t++)
        scanf("%lf",&d);
    for(int t=a;;t++)
    {
        if((b-0.5)*(double)t<=c)
        {
            puts("1");
            //printf("%d",t-a);
            return 0;
        }
        c+=b;
    }
}

#include <iostream>
#include <cmath>
//#include <vector>
using namespace std;

#define ll long long
#define ar array

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        sum += a;
    }
    int av = round(sum / n);
    int i = 1;
    while (av < k)
    {
        sum += k;
        av = round((double) sum / (n + i));
        i++;
    }
    cout << i - 1 << "\n";
    return 0;
}

#include <iostream>

using namespace std;

int main() {
  int N, K;
  std::cin >> N >> K;
  int64_t num = 0;
  int64_t den = N;
  for (int i = 0; i < N; ++i) {
    int64_t x;
    cin >> x;
    num += x;
  }
  for (int j = 0; j < 10000; ++j) {
    int64_t DEN = den + j;
    int64_t NUM = num + j * K;
    if (NUM / DEN < K - 1) continue;
    int64_t lhs = NUM;
    int64_t rhs = K * DEN;
    if (lhs >= rhs || 2 * (NUM % DEN) >= DEN) {
      cout << j << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a,b,i,c;
    double sum=0,av;
    cin>>a>>b;
    for (i=0;i<a;i++)
    {
        cin>>c;
        sum=sum+c;
    }
    for (i=1;i<10;i++)
    {
        sum=(sum+b);
        av=sum/(a+i);
      // cout<<av<<" "<<a+i<<endl;;
        if (round(av)==b) {
            cout<<i;
            break;
        }
    }
}

//freopen("input.txt","r",stdin);
//   freopen("output.txt","w",stdout);
#include <bits/stdc++.h>
using namespace std;
#define op                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0)
#define pi 3.1415926536
int main()
{
    op;
    int m;
    double n,sum1=0,sum2=0;
    cin>>m>>n;

    int i,x,a[m],d=0,z;
    z=n;
    for(i=0;i<m;i++)
      {
          cin>>a[i];
          sum1+=a[i];

      }
    sum2=sum1;
    n=n-0.5;
    while(1)
    {
        sum1+=z;
        m++;
        d++;
        if(sum1/m >= n && sum1/m <= n+0.5)
           {
              cout<<d<<endl;
              return 0;
           }
    }
}