#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
typedef long long ll;
using namespace std;
const ll mod=1000000007;

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