import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int a[] = new int[m];
        for(int i = 0; i < m; i++){
            a[i] = scan.nextInt();
        }
        
        for(int i = 0; i < m; i++){
            n = n - a[i];
        }

        if(n < 0){
            System.out.println("-1");
        }else{
            System.out.println(n);
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int a[] = new int[m];
        for(int i = 0; i < m; i++){
            a[i] = scan.nextInt();
        }
        
        for(int i = 0; i < m; i++){
            n = n - a[i];
        }

        if(n < 0){
            System.out.println("-1");
        }else{
            System.out.println(n);
        }
    }
} Main public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int a[] = new int[m];
        for(int i = 0; i < m; i++){
            a[i] = scan.nextInt();
        }
        
        for(int i = 0; i < m; i++){
            n = n - a[i];
        }

        if(n < 0){
            System.out.println("-1");
        }else{
            System.out.println(n);
        }
    } main {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int a[] = new int[m];
        for(int i = 0; i < m; i++){
            a[i] = scan.nextInt();
        }
        
        for(int i = 0; i < m; i++){
            n = n - a[i];
        }

        if(n < 0){
            System.out.println("-1");
        }else{
            System.out.println(n);
        }
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int m = scan.nextInt(); m scan.nextInt() scan.nextInt scan int a[] = new int[m]; a new int[m] m for(int i = 0; i < m; i++){
            a[i] = scan.nextInt();
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            a[i] = scan.nextInt();
        } {
            a[i] = scan.nextInt();
        } a[i] = scan.nextInt() a[i] a i scan.nextInt() scan.nextInt scan for(int i = 0; i < m; i++){
            n = n - a[i];
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            n = n - a[i];
        } {
            n = n - a[i];
        } n = n - a[i] n n - a[i] n a[i] a i if(n < 0){
            System.out.println("-1");
        }else{
            System.out.println(n);
        } n < 0 n 0 {
            System.out.println("-1");
        } System.out.println("-1") System.out.println System.out System System.out "-1" {
            System.out.println(n);
        } System.out.println(n) System.out.println System.out System System.out n String[] args args public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int a[] = new int[m];
        for(int i = 0; i < m; i++){
            a[i] = scan.nextInt();
        }
        
        for(int i = 0; i < m; i++){
            n = n - a[i];
        }

        if(n < 0){
            System.out.println("-1");
        }else{
            System.out.println(n);
        }
    }
} public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int a[] = new int[m];
        for(int i = 0; i < m; i++){
            a[i] = scan.nextInt();
        }
        
        for(int i = 0; i < m; i++){
            n = n - a[i];
        }

        if(n < 0){
            System.out.println("-1");
        }else{
            System.out.println(n);
        }
    }
} Main
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int a[] = new int[m];
        for(int i = 0; i < m; i++){
            a[i] = scan.nextInt();
        }
        
        for(int i = 0; i < m; i++){
            n = n - a[i];
        }

        if(n < 0){
            System.out.println("-1");
        }else{
            System.out.println(n);
        }
    }
}