import           Data.Char                      ( isSpace )
import           Data.List                      ( unfoldr )
import qualified Data.ByteString.Char8         as C

main = do
    nm <- unfoldr (C.readInt . C.dropWhile isSpace) <$> C.getLine
    a  <- unfoldr (C.readInt . C.dropWhile isSpace) <$> C.getLine
    let holidays = head nm - sum a
    print $ if holidays >= 0 then holidays else -1
