fun main(args: Array<String>) {
    val (n,a)= readLine()!!.split(" ").map { it.toInt() }
    val x= readLine()!!.split(" ").map { it.toInt() }
    val xz = x.count{ it==a }
    val xx =(1..xz).fold(1L){acc,i->acc*2}
    val xr = x.filter { it>a }.map { it-a }.sorted()
    val xl = x.filter { it<a }.map { a-it }.sorted()

    var dpr = LongArray(3000)
    run {
        dpr[0] = 1
        var sumr = 0
        xr.forEach {
            val nextDp = LongArray(3000)
            for (i in 0..sumr) {
                nextDp[i] += dpr[i]
                nextDp[i + it] += dpr[i]
            }
            dpr = nextDp
            sumr += it
        }
    }

    var dpl=LongArray(3000)
    run {
        dpl[0]=1
        var suml=0
        xl.forEach {
            val nextDp = LongArray(3000)
            for (i in 0..suml){
                nextDp[i]+=dpl[i]
                nextDp[i+it]+=dpl[i]
            }
            dpl=nextDp
            suml+=it
        }
    }

    val comb = dpr.mapIndexed {index, it -> it*dpl[index] }
    val ans = comb.map { it*xx }.sum()-1

    println(ans)
}