using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoderCs
{

    class Program
    {

        const int Mod = 1000000007;

        static void Main()
        {

            var arg = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            var useDays = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).Sum();

            Console.WriteLine(arg[0] < useDays ? -1 : arg[0] - useDays);

        }


    }
}
