using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
 
namespace shoboi_program
{
    class MainClass
    {
        public static void Main(string[] args)
        {
          string[] firstLine = Console.ReadLine().Split();
          string[] secondLine = Console.ReadLine().Split();
          
          var x = int.Parse(firstLine[0]);
          var y = int.Parse(firstLine[1]);
          
          long sum = 0;
          	for(var n = 0; n < y; n++)
            {
              sum +=  int.Parse(secondLine[n]);
            }
          
        
          if(sum == x)
          {
            Console.Write("0");
          }
          else if(sum > x)
          {
Console.Write("-1");
          }
          else
          {
            Console.Write("{0}", x-sum);
          }
          
        }
    }
}