//Bismillahir Rahmanir Raheem
//In the name of Allah , Most Gracious , Most Merciful

/*

  * * * * * * *   * * * * * * *   *           *   * * *   * * * * * *
              *   *           *   *           *     *     *           *
              *   *           *   *           *     *     *             *
              *   *           *   *           *     *     *             *
              *   * * * * * * *   * * * * * * *     *     *             *
  *           *   *           *   *           *     *     *             *
  *           *   *           *   *           *     *     *             *
  *           *   *           *   *           *     *     *           *
  * * * * * * *   *           *   *           *   * * *   * * * * * *

*/

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

#define BOOST ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define DEBUG freopen("input.txt","r",stdin)


int main()
{
    BOOST;
    //DEBUG;
    int n,m,s=0,x;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>x;
        s+=x;
    }
    if(s>=x)cout<<n-s<<endl;
    else cout<<-1<<endl;
    return 0;
}



