import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int days = sc.nextInt();
        int n = sc.nextInt();
        
        for (int i = 0; i < n; i++) {
            days -= sc.nextInt();
            if (days < 0) {
                days = -1;
                break;
            }
        }
        
        System.out.println(days);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int days = sc.nextInt();
        int n = sc.nextInt();
        
        for (int i = 0; i < n; i++) {
            days -= sc.nextInt();
            if (days < 0) {
                days = -1;
                break;
            }
        }
        
        System.out.println(days);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int days = sc.nextInt();
        int n = sc.nextInt();
        
        for (int i = 0; i < n; i++) {
            days -= sc.nextInt();
            if (days < 0) {
                days = -1;
                break;
            }
        }
        
        System.out.println(days);
    } main {
        Scanner sc = new Scanner(System.in);
        int days = sc.nextInt();
        int n = sc.nextInt();
        
        for (int i = 0; i < n; i++) {
            days -= sc.nextInt();
            if (days < 0) {
                days = -1;
                break;
            }
        }
        
        System.out.println(days);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int days = sc.nextInt(); days sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for (int i = 0; i < n; i++) {
            days -= sc.nextInt();
            if (days < 0) {
                days = -1;
                break;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            days -= sc.nextInt();
            if (days < 0) {
                days = -1;
                break;
            }
        } {
            days -= sc.nextInt();
            if (days < 0) {
                days = -1;
                break;
            }
        } days -= sc.nextInt() days sc.nextInt() sc.nextInt sc if (days < 0) {
                days = -1;
                break;
            } days < 0 days 0 {
                days = -1;
                break;
            } days = -1 days -1 1 break; System.out.println(days) System.out.println System.out System System.out days String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int days = sc.nextInt();
        int n = sc.nextInt();
        
        for (int i = 0; i < n; i++) {
            days -= sc.nextInt();
            if (days < 0) {
                days = -1;
                break;
            }
        }
        
        System.out.println(days);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int days = sc.nextInt();
        int n = sc.nextInt();
        
        for (int i = 0; i < n; i++) {
            days -= sc.nextInt();
            if (days < 0) {
                days = -1;
                break;
            }
        }
        
        System.out.println(days);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int days = sc.nextInt();
        int n = sc.nextInt();
        
        for (int i = 0; i < n; i++) {
            days -= sc.nextInt();
            if (days < 0) {
                days = -1;
                break;
            }
        }
        
        System.out.println(days);
    }
}
