import java.util.Scanner;

public class Main {

    private static int m_iTotalTaskDays;

    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        final int iVacationDay = Integer.parseInt(sc.next());
        final int iTaskNum = Integer.parseInt(sc.next());
        for (int i = 0; i < iTaskNum; i++) {
            final int iTaskDays = Integer.parseInt(sc.next());
            calcTotalTaskDays(iTaskDays);
        }
        int iResult = iVacationDay - m_iTotalTaskDays;
        if (0 > (iResult)) {
            iResult = -1;
        }
        System.out.print(iResult);
    }

    private static void calcTotalTaskDays(final int iTaskDays) {
        m_iTotalTaskDays += iTaskDays;
    }
} import java.util.Scanner; Scanner java.util public class Main {

    private static int m_iTotalTaskDays;

    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        final int iVacationDay = Integer.parseInt(sc.next());
        final int iTaskNum = Integer.parseInt(sc.next());
        for (int i = 0; i < iTaskNum; i++) {
            final int iTaskDays = Integer.parseInt(sc.next());
            calcTotalTaskDays(iTaskDays);
        }
        int iResult = iVacationDay - m_iTotalTaskDays;
        if (0 > (iResult)) {
            iResult = -1;
        }
        System.out.print(iResult);
    }

    private static void calcTotalTaskDays(final int iTaskDays) {
        m_iTotalTaskDays += iTaskDays;
    }
} Main private static int m_iTotalTaskDays; m_iTotalTaskDays public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        final int iVacationDay = Integer.parseInt(sc.next());
        final int iTaskNum = Integer.parseInt(sc.next());
        for (int i = 0; i < iTaskNum; i++) {
            final int iTaskDays = Integer.parseInt(sc.next());
            calcTotalTaskDays(iTaskDays);
        }
        int iResult = iVacationDay - m_iTotalTaskDays;
        if (0 > (iResult)) {
            iResult = -1;
        }
        System.out.print(iResult);
    } main {

        Scanner sc = new Scanner(System.in);

        final int iVacationDay = Integer.parseInt(sc.next());
        final int iTaskNum = Integer.parseInt(sc.next());
        for (int i = 0; i < iTaskNum; i++) {
            final int iTaskDays = Integer.parseInt(sc.next());
            calcTotalTaskDays(iTaskDays);
        }
        int iResult = iVacationDay - m_iTotalTaskDays;
        if (0 > (iResult)) {
            iResult = -1;
        }
        System.out.print(iResult);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final int iVacationDay = Integer.parseInt(sc.next()); iVacationDay Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc final int iTaskNum = Integer.parseInt(sc.next()); iTaskNum Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc for (int i = 0; i < iTaskNum; i++) {
            final int iTaskDays = Integer.parseInt(sc.next());
            calcTotalTaskDays(iTaskDays);
        } int i = 0; int i = 0; i 0 i < iTaskNum i iTaskNum i++ i++ i {
            final int iTaskDays = Integer.parseInt(sc.next());
            calcTotalTaskDays(iTaskDays);
        } {
            final int iTaskDays = Integer.parseInt(sc.next());
            calcTotalTaskDays(iTaskDays);
        } final int iTaskDays = Integer.parseInt(sc.next()); iTaskDays Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc calcTotalTaskDays(iTaskDays) calcTotalTaskDays iTaskDays int iResult = iVacationDay - m_iTotalTaskDays; iResult iVacationDay - m_iTotalTaskDays iVacationDay m_iTotalTaskDays if (0 > (iResult)) {
            iResult = -1;
        } 0 > (iResult) 0 (iResult) {
            iResult = -1;
        } iResult = -1 iResult -1 1 System.out.print(iResult) System.out.print System.out System System.out iResult String[] args args private static void calcTotalTaskDays(final int iTaskDays) {
        m_iTotalTaskDays += iTaskDays;
    } calcTotalTaskDays {
        m_iTotalTaskDays += iTaskDays;
    } m_iTotalTaskDays += iTaskDays m_iTotalTaskDays iTaskDays final int iTaskDays iTaskDays public class Main {

    private static int m_iTotalTaskDays;

    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        final int iVacationDay = Integer.parseInt(sc.next());
        final int iTaskNum = Integer.parseInt(sc.next());
        for (int i = 0; i < iTaskNum; i++) {
            final int iTaskDays = Integer.parseInt(sc.next());
            calcTotalTaskDays(iTaskDays);
        }
        int iResult = iVacationDay - m_iTotalTaskDays;
        if (0 > (iResult)) {
            iResult = -1;
        }
        System.out.print(iResult);
    }

    private static void calcTotalTaskDays(final int iTaskDays) {
        m_iTotalTaskDays += iTaskDays;
    }
} public class Main {

    private static int m_iTotalTaskDays;

    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        final int iVacationDay = Integer.parseInt(sc.next());
        final int iTaskNum = Integer.parseInt(sc.next());
        for (int i = 0; i < iTaskNum; i++) {
            final int iTaskDays = Integer.parseInt(sc.next());
            calcTotalTaskDays(iTaskDays);
        }
        int iResult = iVacationDay - m_iTotalTaskDays;
        if (0 > (iResult)) {
            iResult = -1;
        }
        System.out.print(iResult);
    }

    private static void calcTotalTaskDays(final int iTaskDays) {
        m_iTotalTaskDays += iTaskDays;
    }
} Main
import java.util.Scanner;

public class Main {

    private static int m_iTotalTaskDays;

    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        final int iVacationDay = Integer.parseInt(sc.next());
        final int iTaskNum = Integer.parseInt(sc.next());
        for (int i = 0; i < iTaskNum; i++) {
            final int iTaskDays = Integer.parseInt(sc.next());
            calcTotalTaskDays(iTaskDays);
        }
        int iResult = iVacationDay - m_iTotalTaskDays;
        if (0 > (iResult)) {
            iResult = -1;
        }
        System.out.print(iResult);
    }

    private static void calcTotalTaskDays(final int iTaskDays) {
        m_iTotalTaskDays += iTaskDays;
    }
}
