#![allow(non_snake_case, unused_imports)] use std::cmp::Reverse; use std::collections::{BinaryHeap, HashMap, HashSet}; use proconio::{input, marker::Usize1, marker::Chars}; use itertools::Itertools; #[allow(unused_macros)] macro_rules! d { ( $( $x:expr ),* $(,)? ) => { eprintln!( concat!( $( stringify!($x), "={:?} " ),* ), $( $x ),* ); }; } #[allow(dead_code)] fn yn(b: bool) -> &'static str { if b { "Yes" } else { "No" } } fn main() { input! { N: usize, X: i64, A: [i64; N], } let tot = A.iter().sum::(); let ans = (tot - X).max(0); println!("{}", ans); }