import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String[] s=reader.readLine().split(" ");
        int n=Integer.parseInt(s[0]);
        int m=Integer.parseInt(s[1]);
        String[] s1=reader.readLine().split(" ");
        int[] days=new int[m];
        int count=0;
        for (int i = 0; i <m ; i++) {
            days[i]=Integer.parseInt(s1[i]);
            count+=days[i];
        }
        if (count<=n)
            System.out.println(n-count);
        else if (count>n)
            System.out.println(-1);

    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String[] s=reader.readLine().split(" ");
        int n=Integer.parseInt(s[0]);
        int m=Integer.parseInt(s[1]);
        String[] s1=reader.readLine().split(" ");
        int[] days=new int[m];
        int count=0;
        for (int i = 0; i <m ; i++) {
            days[i]=Integer.parseInt(s1[i]);
            count+=days[i];
        }
        if (count<=n)
            System.out.println(n-count);
        else if (count>n)
            System.out.println(-1);

    }

} Main public static void main(String[] args) throws IOException {
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String[] s=reader.readLine().split(" ");
        int n=Integer.parseInt(s[0]);
        int m=Integer.parseInt(s[1]);
        String[] s1=reader.readLine().split(" ");
        int[] days=new int[m];
        int count=0;
        for (int i = 0; i <m ; i++) {
            days[i]=Integer.parseInt(s1[i]);
            count+=days[i];
        }
        if (count<=n)
            System.out.println(n-count);
        else if (count>n)
            System.out.println(-1);

    } main {
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String[] s=reader.readLine().split(" ");
        int n=Integer.parseInt(s[0]);
        int m=Integer.parseInt(s[1]);
        String[] s1=reader.readLine().split(" ");
        int[] days=new int[m];
        int count=0;
        for (int i = 0; i <m ; i++) {
            days[i]=Integer.parseInt(s1[i]);
            count+=days[i];
        }
        if (count<=n)
            System.out.println(n-count);
        else if (count>n)
            System.out.println(-1);

    } BufferedReader reader=new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) String[] s=reader.readLine().split(" "); s reader.readLine().split(" ") reader.readLine().split reader.readLine() reader.readLine reader " " int n=Integer.parseInt(s[0]); n Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 int m=Integer.parseInt(s[1]); m Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 String[] s1=reader.readLine().split(" "); s1 reader.readLine().split(" ") reader.readLine().split reader.readLine() reader.readLine reader " " int[] days=new int[m]; days new int[m] m int count=0; count 0 for (int i = 0; i <m ; i++) {
            days[i]=Integer.parseInt(s1[i]);
            count+=days[i];
        } int i = 0; int i = 0; i 0 i <m i m i++ i++ i {
            days[i]=Integer.parseInt(s1[i]);
            count+=days[i];
        } {
            days[i]=Integer.parseInt(s1[i]);
            count+=days[i];
        } days[i]=Integer.parseInt(s1[i]) days[i] days i Integer.parseInt(s1[i]) Integer.parseInt Integer s1[i] s1 i count+=days[i] count days[i] days i if (count<=n)
            System.out.println(n-count);
        else if (count>n)
            System.out.println(-1); count<=n count n System.out.println(n-count) System.out.println System.out System System.out n-count n count if (count>n)
            System.out.println(-1); count>n count n System.out.println(-1) System.out.println System.out System System.out -1 1 String[] args args public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String[] s=reader.readLine().split(" ");
        int n=Integer.parseInt(s[0]);
        int m=Integer.parseInt(s[1]);
        String[] s1=reader.readLine().split(" ");
        int[] days=new int[m];
        int count=0;
        for (int i = 0; i <m ; i++) {
            days[i]=Integer.parseInt(s1[i]);
            count+=days[i];
        }
        if (count<=n)
            System.out.println(n-count);
        else if (count>n)
            System.out.println(-1);

    }

} public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String[] s=reader.readLine().split(" ");
        int n=Integer.parseInt(s[0]);
        int m=Integer.parseInt(s[1]);
        String[] s1=reader.readLine().split(" ");
        int[] days=new int[m];
        int count=0;
        for (int i = 0; i <m ; i++) {
            days[i]=Integer.parseInt(s1[i]);
            count+=days[i];
        }
        if (count<=n)
            System.out.println(n-count);
        else if (count>n)
            System.out.println(-1);

    }

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String[] s=reader.readLine().split(" ");
        int n=Integer.parseInt(s[0]);
        int m=Integer.parseInt(s[1]);
        String[] s1=reader.readLine().split(" ");
        int[] days=new int[m];
        int count=0;
        for (int i = 0; i <m ; i++) {
            days[i]=Integer.parseInt(s1[i]);
            count+=days[i];
        }
        if (count<=n)
            System.out.println(n-count);
        else if (count>n)
            System.out.println(-1);

    }

}