using System;
 

    class Program
    {
        static void Main(string[] args)
        {
 
		// 整数の入力
		var a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray;
		var b = Console.ReadLine().Split(' ').Select(long.Parse).ToArray;
		long playingDay = a[0];
 
	    for (int i = 0; i < a[1]; i++)
        {
            playingDay -= b[i];
            if (playingDay < 0)
            {
                playingDay = 0L;
                playingDay = -1L;
                break;
            }
        }
		
		//出力
		Console.WriteLine(playingDay);
 
        }
    }