use std::str::FromStr;
use std::io::*;
use std::collections::*;
use utils::*;

#[cfg(not(feature = "local"))]
macro_rules! log { ($($e:expr),*) => {}; }

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = AtRead::from(i);
    let (n, a) = i.read2::<usize, usize>();
    let x = i.read_vec::<usize>(n);

    writeln!(o, "{}", solve(a, &x)).unwrap();
}
fn solve(a: usize, x: &[usize]) -> usize {
    let lower: Vec<_> = x.iter().filter(|&&x| x < a).map(|&x| a - x).collect();
    let upper: Vec<_> = x.iter().filter(|&&x| x > a).map(|&x| x - a).collect();
    let mids = x.iter().filter(|&&x| x == a).count();
    let mut result = 0;

    let mut comb_lower = HashMap::<usize, usize>::new();
    for_each_comb(lower.len(), |idx| {
        let sum = idx.iter().map(|&i| lower[i]).sum();
        *comb_lower.entry(sum).or_insert(0) += 1;
    });
    for_each_comb(upper.len(), |idx| {
        let sum = idx.iter().map(|&i| upper[i]).sum();
        result += comb_lower.get(&sum).unwrap_or(&0);
    });
    result * (2 as usize).pow(mids as u32) - 1
}
fn for_each_comb<F: FnMut(&[usize])>(n: usize, mut f: F) {
    let mut idx = Vec::new();
    f(&idx);
    for _ in 0..n {
        idx.push(0);
        for i in 0..idx.len() {
            idx[i] = i;
        }
        let c = idx.len();
        'outer: loop {
            f(&idx);
            for j in 0.. {
                if j == c {
                    break 'outer;
                }
                if idx[c - j - 1] < n - 1 - j {
                    idx[c - j - 1] += 1;
                    for k in 0..j {
                        idx[c - j + k] = idx[c - j + k - 1] + 1;
                    }
                    break;
                }
            }
        }
    }
}

mod utils {
    use super::*;

    pub struct AtRead<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        {$f:ident($($v:ident: $t:ident),*)} => {
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                $(
                    let $v = next(i);
                )*
                ($($v),*)
            }
        };
    }

    impl<R: BufRead> AtRead<R> {
        pub fn from(r: R) -> Self {
            AtRead {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        fn_read! { read2(v1: T1, v2: T2) }

        pub fn read_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            self.read_line()
                .split(' ')
                .take(n)
                .map(|x| x.parse().ok().unwrap())
                .collect()
        }
    }

    fn next<'a, T: FromStr, I: std::iter::Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }

}
