#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long INF = 1LL << 60; 

int main()
{
  int N, M; cin >> N >> M;
  vector<int> A(M);
  rep(i,M) cin >> A[i];
  
  int sum = 0;
  rep(i,M) sum += A[i];
  if(sum <= N) cout << N-sum << endl;
  else cout << "-1" << endl;
}