const check_play_days = (amount) => amount < 0 ? '-1': amount
const calc_play_days = (duration,works) => check_play_days(duration - works.reduce((p,n)=>p+n))
const [holi_days,works_amount] = require('fs').readFileSync('/dev/stdin','utf8').split(' ').map(e=>parseInt(e.replace(/\r?\n/g,'')))
const works = require('fs').readFileSync('/dev/stdin','utf8').split(' ').map(e=>parseInt(e.replace(/\r?\n/g,'')))
works_amount !== works.length ? console.err('error') : console.log(calc_play_days(holi_days,works))