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

#define mp make_pair
#define pb push_back
#define pf push_front
#define ff first
#define ss second
#define ins insert
#define all(X) (X).begin(), (X).end()
#define rall(X) (X).rbegin(), (X).rend()
#define sz(X) ((int)X.size())
#define rsz resize
#define maxel max_element
#define minel min_element
#define ub upper_bound
#define lb lower_bound
#define make_unique(X) sort(all(X)); (X).resize(distance((X).begin(), unique(all(X))));

#define FORN(i, a, b, in) for (int i = (a); i < (b); i += in)
#define FOR(i,a,b) for (auto i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto a : x)

// TYPES
typedef long long ll;
typedef long double ld;
typedef double db;

typedef pair<int,int> pii; 
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;
typedef pair<db,db> pdb;
typedef pair<string,string> pss;

typedef vector< pii > vpii;
typedef vector< pll > vpll; 
typedef vector< pss > vpss;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector< vi > vvi;
typedef vector< vll > vvll;
typedef vector< vb > vvb;

template<class T>using uset = unordered_set<T>;
template<class T>using mset = multiset<T>;
template<class T>using umset = unordered_multiset<T>;
template<class A, class B>using umap = unordered_map<A,B>;
template<class T>using minpq = priority_queue<T,vector<T>,greater<T>>;
template<class T>using maxpq = priority_queue<T,vector<T>,less<T>>;
template<size_t SZ>using bset = bitset<SZ>;

// MOD INT
const int MOD = 1e9+7;
struct mint {
    int val;
    mint() { val = 0; }
    mint(const ll& v) {
        val = (-MOD <= v && v < MOD) ? v : v % MOD;
        if (val < 0) val += MOD;
    }
 
    friend ostream& operator<<(ostream& os, const mint& a) { return os << a.val; }
    friend bool operator==(const mint& a, const mint& b) { return a.val == b.val; }
    friend bool operator!=(const mint& a, const mint& b) { return !(a == b); }
    friend bool operator<(const mint& a, const mint& b) { return a.val < b.val; }
 
    mint operator-() const { return mint(-val); }
    mint& operator+=(const mint& m) { if ((val += m.val) >= MOD) val -= MOD; return *this; }
    mint& operator-=(const mint& m) { if ((val -= m.val) < 0) val += MOD; return *this; }
    mint& operator*=(const mint& m) { val = (ll)val*m.val%MOD; return *this; }
    friend mint mpow(mint a, ll p) {
        mint ans = 1; for (; p; p /= 2, a *= a) if (p&1) ans *= a;
        return ans;
    }
    friend mint inv(const mint& a) { assert(a.val); return mpow(a, MOD - 2); }
    mint& operator/=(const mint& m) { return (*this) *= inv(m); }
 
    friend mint operator+(mint a, const mint& b) { return a += b; }
    friend mint operator-(mint a, const mint& b) { return a -= b; }
    friend mint operator*(mint a, const mint& b) { return a *= b; }
    friend mint operator/(mint a, const mint& b) { return a /= b; }
    operator int64_t() const {return val; }
};

// FUNCTIONS
template<class T> bool amin(T& a, const T& b) {return b<a?a=b,1:0;}
template<class T> bool amax(T& a, const T& b) {return a<b?a=b,1:0;} 
template<typename T> T sqr(T x) {return x*x;}
template<typename T> T cdiv(T a, T b) {return a/b+!(a<0||a%b == 0);}
template<typename T> T lcm(T a, T b) {return (a*b)/__gcd(a, b);}

// INPUT //
template<class A> void re(complex<A>& c);
template<class A, class B> void re(pair<A,B>& p);
template<class A> void re(vector<A>& v);
template<class A, size_t SZ> void re(array<A,SZ>& a);
 
template<class T> void re(T& x) { cin >> x; }
void re(db& d) { string t; re(t); d = stod(t); }
void re(ld& d) { string t; re(t); d = stold(t); }
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }
 
template<class A> void re(complex<A>& c) { A a,b; re(a,b); c = {a,b}; }
template<class A, class B> void re(pair<A,B>& p) { re(p.ff, p.ss); }
template<class A> void re(vector<A>& x) { trav(&a,x) re(a); }
template<class A, size_t SZ> void re(array<A,SZ>& x) { trav(&a,x) re(a); }

// OUTPUT
template<class A> void pr(A x) { cout << x; }
template<class H, class... T> void pr(const H& h, const T&... t) { 
	pr(h); pr(t...); }
void pln() { pr("\n"); }
template<class H, class... T> void pln(const H& h, const T&... t) { 
	pr(h); pln(t...); }
void ps() { pr("\n"); } // print w/ spaces
template<class H, class... T> void ps(const H& h, const T&... t) { 
	pr(h); if (sizeof...(t)) pr(" "); ps(t...); }

template<class A> void pr(vector<A> x) { trav(a, x) pr(a, " "); }
template<class A> void pln(vector<A> x) { trav(a, x) pr(a, " "); pln(); }

// TO_STRING
#define ts to_string
string ts(char c) { return string(1,c); }
string ts(bool b) { return b ? "true" : "false"; }
string ts(const char* s) { return (string)s; }
string ts(string s) { return s; }
template<class A> string ts(complex<A> c) { 
	stringstream ss; ss << c; return ss.str(); }
string ts(vector<bool> v) { 
	string res = "{"; F0R(i,sz(v)) res += char('0'+v[i]);
	res += "}"; return res; }
template<size_t SZ> string ts(bitset<SZ> b) {
	string res = ""; F0R(i,SZ) res += char('0'+b[i]);
	return res; }
template<class A, class B> string ts(pair<A,B> p);
template<class T> string ts(T v) { // containers with begin(), end()
	bool fst = 1; string res = "{";
	for (const auto& x: v) {
		if (!fst) res += ", ";
		fst = 0; res += ts(x);
	}
	res += "}"; return res;
}
template<class A, class B> string ts(pair<A,B> p) {
	return "("+ts(p.ff)+", "+ts(p.ss)+")"; }

// FILE I/O
#pragma GCC diagnostic ignored "-Wunused-result"
void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(string s = "") {
	unsyncIO();
	if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

// DEBUG
template<class H> void DBG(const char *sdbg, H h) { cerr<<sdbg<<" = "<<ts(h)<<"]"<<endl; }
template<class H, class... T> void DBG(const char *sdbg, H h, T... t) {
	while(*sdbg!=',') cerr<<*sdbg++;
	cerr<<" = "<<ts(h)<<", ";
	DBG(sdbg+1, t...);
}

#ifdef LOCAL // compile with -DLOCAL
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [", DBG(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...) 0
#endif

// VARIABLES
const db pi = acos(-1.0);
const int INF = 1e9 + 7;
const ll llINF = ((ll)1e18) + 7LL;
const int mxN = 1e5 + 7;

int main() {
	setIO();
	
	int n, k;
	re(n, k);
	
	vi a(k);
	re(a);
	
	int sum = 0;
	F0R(i, k) {
		sum += a[i];
	}
	if (sum > n)
		pln(-1);
	else
		pln(n - sum);
	// you should actually read the stuff at the bottom
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smthn instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


Measured memory_bytes: 3708