#![allow(non_snake_case)] #![allow(unused_imports)] //use itertools::Itertools; //use proconio::input; //use proconio::marker::*; use std::cmp::Reverse; use std::collections::*; fn main() { input! { n:usize, k:i64, a:[i64;n], } let mut hs0 = HashSet::new(); let mut hs1 = HashSet::new(); f(0, 0, &a[..n / 2], false, false, &mut hs0); f(0, 0, &a[n / 2..], false, false, &mut hs1); let mut ans = hs0.contains(&(k, true, true)) || hs1.contains(&(k, true, true)); for &(x, b0, b1) in hs0.iter() { for c0 in [false, true] { for c1 in [false, true] { if hs1.contains(&(k - x, c0, c1)) && (b0 || c0) && (b1 || c1) { ans = true; } } } } println!("{}", if ans { "Yes" } else { "No" }); } fn f(id: usize, x: i64, a: &[i64], plus: bool, minus: bool, hs: &mut HashSet<(i64, bool, bool)>) { if id == a.len() { hs.insert((x, plus, minus)); return; } f(id + 1, x + a[id], a, true, minus, hs); f(id + 1, x - a[id], a, plus, true, hs); f(id + 1, x, a, plus, minus, hs); } mod input { #[macro_export] macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); input_inner!{iter, $($r)*} }; ($($r:tt)*) => { let s = { use std::io::Read; let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); s }; let mut iter = s.split_whitespace(); input_inner!{iter, $($r)*} }; } #[macro_export] macro_rules! input_inner { ($iter:expr) => {}; ($iter:expr, ) => {}; ($iter:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($iter, $t); input_inner!{$iter $($r)*} }; } #[macro_export] macro_rules! read_value { ($iter:expr, ( $($t:tt),* )) => { ( $(read_value!($iter, $t)),* ) }; ($iter:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($iter, $t)).collect::>() }; ($iter:expr, chars) => { read_value!($iter, String).chars().collect::>() }; ($iter:expr, usize1) => { read_value!($iter, usize) - 1 }; ($iter:expr, $t:ty) => { $iter.next().unwrap().parse::<$t>().expect("Parse error") }; } }