#include<stdio.h>
#include<math.h>
#define pb push_back
//#define FAST ios::sync_with_stdio(false);cin.tie(NULL),cout.tie(NULL);
//typedef long long ll;
#define pi acos(-1.0)
//using namespace std;

int main()
{
     int n,m,a,b=0,ans=0;
scanf("%d%d",&n,&m);
     while(m--)
     {
scanf("%d",&a) ;
        b+=a;
     }
     if(n-b>=0)
        printf("%d\n",n-b);
     else
        printf("-1\n");
//    cin>>r;
//    cout<<2*pi*r<<fixed<<setprecision(12)<<endl;
    return 0;
}
