/**
 *      ///----- My Info -----///
 *      Code by: Ernesto Abreu
 *      Codeforces User: Ernest0_0Abreu
 *      Country: Cuba
 *      E-mail: ernestoabreup@gmail.com
 *      CopyRight
**/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;
        ///----- My Template -----///
#define int long long
///=====================================================================================================================
/// Red-Black Tree
// #include <ext/pb_ds/assoc_container.hpp>  // .find_of_order(x); .order_of_key(x);
// using namespace __gnu_pbds;
// typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > indexed_set;
/// Typedef
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
/// Function
#define pi (acos(-1))
#define lg2(x) 31-__builtin_clz(x)
#define lgx(x,b) log(b)/log(x)
/// Macros
#define fst first
#define scd second
#define pb push_back
#define	up upper_bound
#define lb lower_bound
#define left (node<<1)
#define right ((node<<1)+1)
#define sz(x) (int)(x.size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
/// Debug
#define _end cout << "\n"
#define debug(x) cerr << #x << " = " << x << " "
#define db(x) cerr << "[" << #x << "]: " << to_string(x) << '\n'
template <typename A, typename B> string to_string(pair<A, B> p);
string to_string(const string& s){ return '"' + s + '"'; }
string to_string(const char* s){ return to_string((string) s); }
string to_string(char &c){ string s; s += c; return s; }
string to_string(bool b){ return (b ? "true" : "false"); }
string to_string(vector<bool> v){ bool first = true; string res = "{"; for(int i = 0 ; i < static_cast<int>(v.size()) ; i++){if(!first){res += ", ";}first = false;res += to_string(v[i]);}res += "}"; return res;}
template <size_t N> string to_string(bitset<N> v){string res = "";for(size_t i = 0 ; i < N ; i++){ res += static_cast<char>('0' + v[i]); }return res;}
template <typename A> string to_string(A v){bool first = true;string res = "{";for(const auto &x : v){if(!first){ res += ", "; }first = false;res += to_string(x);}res += "}"; return res;}
template <typename A, typename B> string to_string(pair<A, B> p){ return "(" + to_string(p.first) + " , " + to_string(p.second) + ")"; }
/// Constant
const int MAXN = 1e6+7;
const int MOD = 1e9+7;
const ull BASE = 311;
const ld EPS = 1e-9;
const int INF = ((1<<30)-1);
const ll INFLL = ((1ll<<62ll)-1ll);
const ll oo = 2e18;
/// Hash Prime Numbers: 2, 277, 293, 307, 331, 337, 1009, 2027;
/// Module Prime Numbers: 3, 998244353, 1000000007, 1000000009, 1000000021, 1000000033;
///=====================================================================================================================
        ///----- My code -----///

int ar[MAXN];

int32_t main (){
	
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
	cout.setf(ios::fixed);cout.precision(0);
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		//freopen("output.txt", "w", stdout);
	#endif
	int N, M;
	cin >> N >> M;
	for(int i = 1; i <= M; i++){
		cin >> ar[i];
		N-=ar[i];
	}

	if(N<0) cout << -1;
	else cout << N;

    return 0;
}


Measured memory_bytes: 3680