#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main()
{
  int n, m;
  cin >> n >> m;
  int a[m];
  int total = 0;
  rep(i, m){
    cin >> a[i];
    total += a[i];
  }
  if(total > n) cout << -1 << endl;
  else cout << n - total << endl;
  return 0;
}
