import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.Array.Unboxed
import Data.Bits
import Data.List
import qualified  Data.ByteString as B


bsToInt :: BS.ByteString -> Int
bsToInt = fst . fromJust . BS.readInt

bsToIntList :: BS.ByteString -> [Int]
bsToIntList = map bsToInt . BS.words

main :: IO ()
main = do 
    (n:m:_) <- bsToIntList <$> BS.getLine
    as <- bsToIntList <$> BS.getLine
    let rst = n - sum as
    let res = if rst < 0 then -1 else rst
    print $ res