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

/*** Typedef ***/
typedef long long ll;
typedef unsigned long long ull;
typedef    long double   ld;
typedef    complex<ld>   P;
#define    X   real()
#define    Y   imag()
ld restant(P p)
{
    return abs(p);
}
///polar(x,y) mag=l,arg=y
///typedef    unordered_set<ll>   usll;
///typedef    unordered_multiset<ll>   umsll;

/*** Loops ***/
#define ffit(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)
#define ff1(i,a,b) for(ll i = a; i <b; i++)
#define ff2(i,a,b) for(ll i = b-1; i >= a; i--)
#define ff3(i,a,b,m) for(ll i = a; i <=b; i+=m)
#define ipar(ar,n) ll ar[n]; ff1(i,0,n) cin>>ar[i];
#define opar(ar,n) ff1(i,0,n) cout<<ar[i]<<" ";
#define foRev(num) for(ll i = num - 1; i >= 0; i--)
#define forIn(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);
#define forIn1(arr, num) for(ll i = 1; i <= num; i++) sc1(arr[i]);
#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

/*** Define Values ***/
#define mod 1000000007
#define PI acos(-1.0)
#define eps 1e-7
#define size1 15

/*** STLs ***/
#define rsz(x...) resize(x)
#define ins(x...) insert(x)
#define ft() front()
#define bk() back()
#define eb(x...) emplace_back(x)
#define lb(x...) lower_bound(x)
#define ub(x...) upper_bound(x)
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))
#define MIN3(n1,n2,n3) min(n1,min(n2,n3))
#define MIN4(n1,n2,n3,n4) min(n1,min(n2,min(n3,n4)))
#define MAX3(n1,n2,n3) max(n1,max(n2,n3))
#define MAX4(n1,n2,n3,n4) max(n1,max(n2,max(n3,n4)))
#define max_arr(a,n) *max_element(a,a+n)
#define min_arr(a,n) *min_element(a,a+n)
#define arr_sum(a,n) accumulate(a,a+n,0)
#define vec_sum(ve) accumulate(ve.begin(),ve.end(),0)
#define max_vec(ve) *max_element(ve.begin(),ve.end())
#define min_vec(ve) *min_element(ve.begin(),ve.end())
//#define endl " \n"

/*** STLs ***/
typedef vector <ll> vll;
#define vvll vector<vll>
typedef set <ll> sll;
typedef multiset <ll> msll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;
///typedef    unordered_multiset<int>   umsi;
///typedef    unordered_set<int>   usi;
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity

///vector<vector<int>> v(10, vector<int>(20,500)); 2d vector initialization. of 10 rows and 20 columns, with value 500.

/*** Sorts ***/
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtgrt(v) sort(all(v), greater<ll>())
#define prsrt greater<pair<int,int>>()
/*** Some Prints ***/
#define q2(n) (n%2)==0
#define ip(n) ll n; cin>>n;
#define en cout << '\n';
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": ";
#define ps(x,y)         fixed<<setprecision(y)<<x
#define inf             1e18
#define debug(x) cout << '>' << #x << ':' << x << endl;
const ll N = 1e6 + 9;
#define w(x)             ll x; cin>>x; while(x--)
bool isPerfectSquare(long double x) {long double sr = sqrt(x); return ((sr - floor(sr)) == 0); }

bool boundary(ll i,ll j,ll n, ll m){return (i>=0 && i<n && j>=0 &&  j<m);} //matrix boundary checking

ll ceil(const ll &a, const ll &b){return (a - 1)/b + 1;}
int lcm(int a, int b){return (a*b)/__gcd(a, b);}

string alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

int dx[4] = {0, 0, -1, 1};
int dy[4] = {-1, 1, 0, 0};

bool prime[10000005];
void SieveOfEratosthenes(int n)
{
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1] = 0;
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
    }
}
ll bigmod(ll n,ll pow){
if(pow==0) return 1;
if(pow==1) return n%mod;

ll ans=bigmod(n,pow/2);
ans=(ans*ans)%mod;

if(pow%2==1){ans=(ans*n)%mod;}
return ans%mod;
}
ll fact[1000005];

ll nCr(ll n,ll r){

ll ans=fact[n];
ans=(ans*bigmod(fact[r],mod-2))%mod;
ans=(ans*bigmod(fact[n-r],mod-2))%mod;
return ans;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ip(n);ip(k);
    ipar(a,k);ll s = 0;
    ff1(i,0,k) s+=a[i];
    if(s>n) cout<<-1;
    else cout<<n-s;
    return 0;
}


Measured memory_bytes: 3736