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

typedef long long ll ;
typedef long double ld ;
typedef vector<int> vi ;
typedef pair<int , int > pii ;

#define rep(n)      for (int i = 0 ; i < n ; i++)
#define pb        push_back
#define all(a)      a.begin(),a.end()
#define endl  '\n'
#define NumofDigits(n)    ((long long)log10(n)+1)
#define isPowerOfTwo(n)    (n && !(n & (n - 1)))
#define mem(a, n)         memset(a, n, sizeof(a))
#define Unique(n)         (n).erase(unique(all(n)), (n).end())

void quick (){cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);}
void readFromText()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
#endif // ONLINE_JUDGE
}

int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

void duplicate (int& a , int& b , int& c) {
    a*=2;
    b*=2;
    c*=2;
}

int add (int a, int b) {
    return (a+b) ;
}

void print (int n ) {
    for (int i = 1 ; i <= n ; i++){
        if (i!=n){
            cout << i << " ";
        }else {
            cout << i ;
        }
    }
}

string toBinary (int n) {
    string out = "" ;
    while (n!=0){
        if (n%2!=0)out+="1";
        else out+="0";
        n/=2;
    }
    return out ;
}



void swapp (int& a , int& b) {
    int temp = a;
    a = b ;
    b = temp ;
}

long long equation (int x , int n ) {
    long long value = 0 ;
    for (int i = 2 ; i <= n ; i++){
        if (i%2==0)value+=pow(x,i);
    }
    return value ;
}

int maxx (int arr [], int n) {
    int maxx = INT_MIN ;
    for (int i = 0 ; i < n ; i++){
        if (arr[i]>maxx)maxx=arr[i];
    }
    return maxx ;
}

int minn (int arr [], int n) {
    int minn = INT_MAX ;
    for (int i = 0 ; i < n ; i++){
        if (arr[i]<minn)minn=arr[i];
    }
    return minn ;
}

void timess (int n , char a) {
    while (n--){
        cout << a << " ";
    }
    cout << endl ;
}

double aver (double arr [] , int n ) {
    double sum = 0 ;
    for (int i = 0 ; i < n ; i++)sum+=arr[i];
    return sum/n;
}

int* mergee (int a [] , int n , int b []) {
    int newOne [n+n] = {0};
    for (int i = 0 ; i < n ; i++){
        newOne[i]=b[i];
    }
    for (int i = n ; i < (2*n) ; i++){
        newOne[i]=a[i];
    }
    return newOne;
}

int dist (int arr[] , int n) {
    const int MAX = 1e3 ;
    int counter = 0 ; int freq [(2*MAX)+1]={0};
    for (int i = 0 ; i < n ; i++){
        if (freq[arr[i]+MAX]==0){
            counter++;
            freq[arr[i]+MAX]++;
        }
    }
    return counter;
}


void powerr (int x ,int n)
{
    long long po = x*x;
    long long sum = 0 ;
    long long y = 1;
    for(int i = 2 ; i <= n ; i+=2)
    {
        y *= po;
        sum += y;
    }
    cout << sum ;
}

bool checkPali (string s) {
    bool pali = true ;
    for (int i = 0 ; i < s.length()/2 ; i++){
        if (s[i]!=s[s.length()-i-1]){
            pali = false ;
            break ;
        }
    }
    return pali ;
}

bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
}

int numOfPali (int arr [] , int n){
    int counter = 0 ;
    for (int i = 0 ; i < n ; i++){
        string curr = to_string(arr[i]);
        if (checkPali(curr))counter++;
    }
    return counter;
}

int pri (int arr [] , int n ) {
    int pri = 0 ;
    for (int i = 0 ; i < n ; i++){
        if (isPrime(arr[i]))pri++;
    }
    return pri ;
}

int countDiv (int arr [] , int n ) {
    int maxx = 0 ,  num = 0;
    for (int i = 0 ; i < n ; i++){
        int counter = 0 ;
        for (int j = 1 ; j <= arr[i] ; j++ ){
            if (arr[i]%j==0)counter++;
        }
        if (counter>maxx){
            maxx=counter;
            num=arr[i];
        }
    }
    return num;
}

const int N = 2e5;
int freq [N+1] ;
int freqq[N+1] ;

int main()
{
//    quick();
//    readFromText();
    int n , m ; cin >> n >> m ; int sum = 0 ;
    for (int i = 0 ; i < m ; i++){
        int xx ; cin >> xx ;
        sum += xx ;
    }
    if (sum<=n)cout<<(n-sum)<<endl;
    else cout << -1 << endl ;

    return 0 ;
}

unsigned long long pow(long long base, long long power){
    if(power==0)
        return 1;
    if(power==1)
        return base;

    unsigned long long ans = pow(base, power/2);
    ans *= ans;

    if(power&1)
        return ans*base;
    return ans;
}


Measured memory_bytes: 3604