import java.util.Scanner;
import java.lang.Math;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),
            m = sc.nextInt();
        int A = 0;
        for(int i=0;i<m;i++){
            A = A + sc.nextInt();
        }
        if(A <= n){
            System.out.print(n-A);
        }else{
            System.out.print(-1);
        }
        
    }
} import java.util.Scanner; Scanner java.util import java.lang.Math; Math java.lang class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),
            m = sc.nextInt();
        int A = 0;
        for(int i=0;i<m;i++){
            A = A + sc.nextInt();
        }
        if(A <= n){
            System.out.print(n-A);
        }else{
            System.out.print(-1);
        }
        
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),
            m = sc.nextInt();
        int A = 0;
        for(int i=0;i<m;i++){
            A = A + sc.nextInt();
        }
        if(A <= n){
            System.out.print(n-A);
        }else{
            System.out.print(-1);
        }
        
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),
            m = sc.nextInt();
        int A = 0;
        for(int i=0;i<m;i++){
            A = A + sc.nextInt();
        }
        if(A <= n){
            System.out.print(n-A);
        }else{
            System.out.print(-1);
        }
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt() n sc.nextInt() sc.nextInt sc m = sc.nextInt(); m sc.nextInt() sc.nextInt sc int A = 0; A 0 for(int i=0;i<m;i++){
            A = A + sc.nextInt();
        } int i=0; int i=0; i 0 i<m i m i++ i++ i {
            A = A + sc.nextInt();
        } {
            A = A + sc.nextInt();
        } A = A + sc.nextInt() A A + sc.nextInt() A sc.nextInt() sc.nextInt sc if(A <= n){
            System.out.print(n-A);
        }else{
            System.out.print(-1);
        } A <= n A n {
            System.out.print(n-A);
        } System.out.print(n-A) System.out.print System.out System System.out n-A n A {
            System.out.print(-1);
        } System.out.print(-1) System.out.print System.out System System.out -1 1 String[] args args
import java.util.Scanner;
import java.lang.Math;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),
            m = sc.nextInt();
        int A = 0;
        for(int i=0;i<m;i++){
            A = A + sc.nextInt();
        }
        if(A <= n){
            System.out.print(n-A);
        }else{
            System.out.print(-1);
        }
        
    }
}