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

int main()
{
  int n, m, sum = 0;
  cin >> n >> m;
  int a[m];
  
  for(int i = 1; i <= m; i++){
    cin >> a[i];
    sum += a[i];
  }
  
  int result = n - sum;
  
  if(result >= 0)
  {
     cout << result << "\n";
  }
  else {
      cout << "-1" << "\n";
  }
}
