import java.util.*;

class Main
{
  public static void main(String[] args)
  {
    Scanner stdIn = new Scanner(System.in);
    int N;
    int M;
    
    N = stdIn.nextInt();
    M = stdIn.nextInt();
    
    int sum = 0;
    for(int i = 0; i < M; i++)
    {
      sum += stdIn.nextInt();
    }
    
    int ans = N - sum;
    if(ans < 0)
    {
      System.out.println(-1);
    }
    else
    {
      System.out.println(ans);
    }
      
  }
} import java.util.*; util.* java class Main
{
  public static void main(String[] args)
  {
    Scanner stdIn = new Scanner(System.in);
    int N;
    int M;
    
    N = stdIn.nextInt();
    M = stdIn.nextInt();
    
    int sum = 0;
    for(int i = 0; i < M; i++)
    {
      sum += stdIn.nextInt();
    }
    
    int ans = N - sum;
    if(ans < 0)
    {
      System.out.println(-1);
    }
    else
    {
      System.out.println(ans);
    }
      
  }
} Main public static void main(String[] args)
  {
    Scanner stdIn = new Scanner(System.in);
    int N;
    int M;
    
    N = stdIn.nextInt();
    M = stdIn.nextInt();
    
    int sum = 0;
    for(int i = 0; i < M; i++)
    {
      sum += stdIn.nextInt();
    }
    
    int ans = N - sum;
    if(ans < 0)
    {
      System.out.println(-1);
    }
    else
    {
      System.out.println(ans);
    }
      
  } main {
    Scanner stdIn = new Scanner(System.in);
    int N;
    int M;
    
    N = stdIn.nextInt();
    M = stdIn.nextInt();
    
    int sum = 0;
    for(int i = 0; i < M; i++)
    {
      sum += stdIn.nextInt();
    }
    
    int ans = N - sum;
    if(ans < 0)
    {
      System.out.println(-1);
    }
    else
    {
      System.out.println(ans);
    }
      
  } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int N; N int M; M N = stdIn.nextInt() N stdIn.nextInt() stdIn.nextInt stdIn M = stdIn.nextInt() M stdIn.nextInt() stdIn.nextInt stdIn int sum = 0; sum 0 for(int i = 0; i < M; i++)
    {
      sum += stdIn.nextInt();
    } int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
      sum += stdIn.nextInt();
    } {
      sum += stdIn.nextInt();
    } sum += stdIn.nextInt() sum stdIn.nextInt() stdIn.nextInt stdIn int ans = N - sum; ans N - sum N sum if(ans < 0)
    {
      System.out.println(-1);
    }
    else
    {
      System.out.println(ans);
    } ans < 0 ans 0 {
      System.out.println(-1);
    } System.out.println(-1) System.out.println System.out System System.out -1 1 {
      System.out.println(ans);
    } System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;

class Main
{
  public static void main(String[] args)
  {
    Scanner stdIn = new Scanner(System.in);
    int N;
    int M;
    
    N = stdIn.nextInt();
    M = stdIn.nextInt();
    
    int sum = 0;
    for(int i = 0; i < M; i++)
    {
      sum += stdIn.nextInt();
    }
    
    int ans = N - sum;
    if(ans < 0)
    {
      System.out.println(-1);
    }
    else
    {
      System.out.println(ans);
    }
      
  }
}