use std::io::{self, BufRead}; fn main() { let input = io::stdin() .lock() .lines() .flat_map(|l| { l.unwrap() .split_whitespace() .map(|n| n.parse::().unwrap()) .collect::>() }) .collect::>(); let n_beans = input[0] * input[1]; let n_consume = input[3..].iter().sum::(); match n_beans - n_consume { rem if rem >= 0 => println!("{}", rem), _ => println!("-1"), } }