#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n, k, m;
  cin >> n >> k >> m;
  int sm = 0;
  rep(i, n - 1) {
    int a;
    cin >> a;
    sm += a;
  }
  int ans = m * n - sm;
  if (ans < 0) ans = 0;
  if (ans > k)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}

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

#define int long long
#define rep(i,n) for(int i=0;i<n;i++)

int T;

int extGCD(int a, int b, int &x, int &y)
{
    if(b == 0)
    {
        x = 1;
        y = 0;
        return a;
    }

    int ret = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return ret;
}

int unit(int a, int b)
{
    if(a < 0)return 0;
    return (a + b - 1) / b;
}

signed main()
{
    cin >> T;
    rep(_, T)
    {
        int X, Y, P, Q;
        cin >> X >> Y >> P >> Q;

        int T1 = 2 * (X + Y), T2 = P + Q;
        int ans = -1;
        rep(i, Y)rep(j, Q)
        {
            int x, y;
            int c = P + j - X - i;
            int d = extGCD(T1, -T2, x, y);
            if(d < 0)
            {
                d = -d;
                x = -x;
                y = -y;
            }
            if(c % d != 0)continue;
            // cout << T1 << "*" << x << "+" << -T2 << "*" << y << "=" << d << endl;
            x *= c / d, y *= c / d;
            
            // cout << T1 << "*" << x << "+" << -T2 << "*" << y << "=" << c << endl;

            int t1 = T1 / d, t2 = T2 / d;

            if(x < 0 || y < 0)
            {
                int MAX = max(unit(-x, t2), unit(-y, t1));
                // cout << "((" << -x << ", " << t2 << ")" << unit(-x, t2) << ", " << "(" << -y << ", " << t2 << ")" << unit(-y, t1) << ")" << endl;
                // cout << "MAX : " << MAX << endl;
                x += MAX * t2, y += MAX * t1;
                if(ans == -1)ans = x * T1 + i + X;
                else ans = min(ans, x * T1 + i + X);
                // assert(x * T1 + i + X == y * T2 + P + j);
            }
            else
            {
                int MIN = min(x / t2, y / t1); 
                // cout << "MIN : " << MIN << endl;
                x -= MIN * t2, y -= MIN * t1;
                if(ans == -1)ans = x * T1 + i + X;
                else ans = min(ans, x * T1 + i + X);
                // assert(x * T1 + i + X == y * T2 + P + j);
            }
        }

        if(ans == -1)cout << "infinity " << endl;
        else cout << ans << endl;
    }
    return 0;
}