using System;

namespace abc._20200419
{
    class Program
    {
        static void Main(string[] args)
        {

		// 整数の入力
		long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray;
		long[] 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);

        }
    }
}
