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

typedef long long ll;
typedef pair<int, int> pii;

const int N = 1e5 + 11;
const int M = 1e6 + 11;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);

int main(int argc, char **args){
  //  freopen("in.txt", "r", stdin);
    int sum, n; cin >> sum >> n;
    int t = 0;
    for(int i = 0; i < n; i++)
        {
            int c; cin >>c;
            t += c;
        }
    if(t > sum ) puts("-1");
    else cout << sum - t <<"\n";
return 0;
}