Buggy python submission (verdict: Time Limit Exceeded):
n,a=map(int,input().split())
x=list(map(int,input().split()))
#n=4
#a=8
#x=[7,9,8,9]

#xsum=max(max(x),a)*n
xsum=max(sum(x),a*n)
dp=[[[0]*(xsum+1) for i in range(n+1)] for ii in range(n+1)]

dp[0][0][0]=1

for j in range(1,n+1):
    for k in range(0,n+1):    
        for s in range(0,xsum+1):    
            if s<x[j-1] :
                dp[j][k][s]=dp[j-1][k][s]
            elif s>=x[j-1] and k>=1:
                dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-x[j-1]]
            else:
                dp[j][k][s]=0
dsum=0
for k in range(1,n+1):
    dsum=dsum+dp[n][k][k*a]
print(dsum)
    

Fixed submission:
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

print(dp[n][nx]-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,a=map(int,input().split())
x=list(map(int,input().split()))

xsum=max(max(x),a)*n
dp=[[[0]*(xsum+1) for i in range(n+1)] for ii in range(n+1)]

dp[0][0][0]=1

for j in range(1,n+1):
    for k in range(0,n+1):    
        for s in range(0,xsum+1):    
            if s<x[j-1] :
                dp[j][k][s]=dp[j-1][k][s]
            elif s>=x[j-1] and k>=1:
                dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-x[j-1]]
            else:
                dp[j][k][s]=0
dsum=0
for k in range(1,n+1):
    dsum=dsum+dp[n][k][k*a]
print(dsum)
    

Fixed submission:
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

print(dp[n][nx]-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,a=map(int,input().split())
x=list(map(int,input().split()))

xmax=max(max(x),a)
    
nx=n*xmax
dp=[[[0]*(nx+1) for ii in range(n+1)] for i in range(n+1)]

dp[0][0][0]=1

for j in range(1,n+1):
    jj=j-1
    for k in range(n+1):
        for s in range(nx+1):
            if s<x[jj]:
                dp[j][k][s]=dp[j-1][k][s]
            elif 1<=k and  x[jj]<=s:
                dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-x[jj]]
            else:
                dp[j][k][s]=0
#            if dp[j][k][s]!=0:
#                print(j,k,s,dp[j][k][s])
dpsum=0
for k in range(1,n+1):
    dpsum=dpsum+dp[n][k][k*a]
                
print(dpsum)
        


Fixed submission:
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

print(dp[n][nx]-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
n2=n//5
n3=n-n2*4

y1=[]
y2=[]
y3=[]
y4=[]
for i in range(n2):
    y1.append(x[i])
    y2.append(x[i+n2])
    y3.append(x[i+n2*2])
    y4.append(x[i+n2*3])
y9=[]
for i in range(n3):
    y9.append(x[i+n2*4])
    
# itertools 使用 bit全探索
import itertools

def xdic(n2,xx):
    xsum=dict()
    for i in itertools.product([0,1], repeat=n2):
        isum=0
        for ii in range(n2):
            if i[ii]==0:
                isum=isum+xx[ii]
        if isum in xsum:
            xsum[isum]=xsum[isum]+1
        else:
            xsum[isum]=1
    return xsum

xsum1=xdic(n2,y1)
xsum2=xdic(n2,y2)
xsum3=xdic(n2,y3)
xsum4=xdic(n2,y4)
xsum9=xdic(n3,y9)
    
icnt=0
for xs1 in xsum1.items():
    for xs2 in xsum2.items():
        for xs3 in xsum3.items():
            for xs4 in xsum4.items():
                for xs9 in xsum9.items():
                    if xs1[0]+xs2[0]+xs3[0]+xs4[0]+xs9[0]==0:
                        icnt=icnt+xs1[1]*xs2[1]*xs3[1]*xs4[1]*xs9[1]

print(icnt-1)                        


Fixed submission:
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

print(dp[n][nx]-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
n2=n//5
n3=n-n2*4

y1=[]
y2=[]
y3=[]
y4=[]
for i in range(n2):
    y1.append(x[i])
    y2.append(x[i+n2])
    y3.append(x[i+n2*2])
    y4.append(x[i+n2*3])
y9=[]
for i in range(n3):
    y9.append(x[i+n2*4])
    
# itertools 使用 bit全探索
import itertools

def xdic(n2,xx):
    xsum=dict()
    for i in itertools.product([0,1], repeat=n2):
        isum=0
        for ii in range(n2):
            if i[ii]==0:
                isum=isum+xx[ii]
        if isum in xsum:
            xsum[isum]=xsum[isum]+1
        else:
            xsum[isum]=1
    return xsum

xsum1=xdic(n2,y1)
xsum2=xdic(n2,y2)
xsum3=xdic(n2,y3)
xsum4=xdic(n2,y4)
xsum9=xdic(n3,y9)
    
icnt=0
for xs1 in xsum1.items():
    for xs2 in xsum2.items():
        for xs3 in xsum3.items():
            for xs4 in xsum4.items():
                for xs9 in xsum9.items():
                    if xs1[0]+xs2[0]+xs3[0]+xs4[0]+xs9[0]==0:
                        icnt=icnt+xs1[1]*xs2[1]*xs3[1]*xs4[1]*xs9[1]

print(icnt-1)                        


Fixed submission:
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

print(dp[n][nx]-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
n2=n//8
n3=n-n2*8

y1=[]
y2=[]
y3=[]
y4=[]
y5=[]
y6=[]
y7=[]
y8=[]
for i in range(n2):
    y1.append(x[i])
    y2.append(x[i+n2])
    y3.append(x[i+n2*2])
    y4.append(x[i+n2*3])
    y5.append(x[i+n2*4])
    y6.append(x[i+n2*5])
    y7.append(x[i+n2*6])
    y8.append(x[i+n2*7])
y9=[]
for i in range(n3):
    y9.append(x[i+n2*8])
    
# itertools 使用 bit全探索
import itertools

def xdic(n2,xx):
    xsum=dict()
    for i in itertools.product([0,1], repeat=n2):
        isum=0
        for ii in range(n2):
            if i[ii]==0:
                isum=isum+xx[ii]
        if isum in xsum:
            xsum[isum]=xsum[isum]+1
        else:
            xsum[isum]=1
    return xsum

xsum1=xdic(n2,y1)
xsum2=xdic(n2,y2)
xsum3=xdic(n2,y3)
xsum4=xdic(n2,y4)
xsum5=xdic(n2,y5)
xsum6=xdic(n2,y6)
xsum7=xdic(n2,y7)
xsum8=xdic(n2,y8)
xsum9=xdic(n3,y9)
    
icnt=0
for xs1 in xsum1.items():
    for xs2 in xsum2.items():
        for xs3 in xsum3.items():
            for xs4 in xsum4.items():
                for xs5 in xsum5.items():
                    for xs6 in xsum6.items():
                        for xs7 in xsum7.items():
                            for xs8 in xsum8.items():
                                for xs9 in xsum9.items():
                                    if xs1[0]+xs2[0]+xs3[0]+xs4[0]+xs5[0]+xs6[0]+xs7[0]+xs8[0]+xs9[0]==0:
                                        icnt=icnt+xs1[1]*xs2[1]*xs3[1]*xs4[1]*xs5[1]*xs6[1]*xs7[1]*xs8[1]*xs9[1]

print(icnt-1)                        


Fixed submission:
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

print(dp[n][nx]-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a

n2=n//4
n3=n-n2*4

y1=[]
y2=[]
y3=[]
y4=[]
for i in range(n2):
    y1.append(x[i])
    y2.append(x[i+n2])
    y3.append(x[i+n2*2])
    y4.append(x[i+n2*3])
#    y5.append(x[i+n2*4])
#    y6.append(x[i+n2*5])
#    y7.append(x[i+n2*6])
#    y8.append(x[i+n2*7])
y9=[]
for i in range(n3):
    y9.append(x[i+n2*4])
    

# itertools 使用 bit全探索
import itertools

def xdic(n2,xx):
    xsum=dict()
    for i in itertools.product([0,1], repeat=n2):
        isum=0
        for ii in range(n2):
            if i[ii]==0:
                isum=isum+xx[ii]
        if isum in xsum:
            xsum[isum]=xsum[isum]+1
        else:
            xsum[isum]=1
    return xsum

xsum1=xdic(n2,y1)
xsum2=xdic(n2,y2)
xsum3=xdic(n2,y3)
xsum4=xdic(n2,y4)
#xsum5=xdic(n2,y5)
#xsum6=xdic(n2,y6)
#xsum7=xdic(n2,y7)
#xsum8=xdic(n2,y8)
xsum9=xdic(n3,y9)
  
#xsum[0]=xsum[0]
#print(xsum)        
    
icnt=0
for xs1 in xsum1.items():
    for xs2 in xsum2.items():
        for xs3 in xsum3.items():
            for xs4 in xsum4.items():
                for xs9 in xsum9.items():
                    if xs1[0]+xs2[0]+xs3[0]+xs4[0]+xs9[0]==0:
                        icnt=icnt+xs1[1]*xs2[1]*xs3[1]*xs4[1]*xs9[1]

print(icnt-1)                        


Fixed submission:
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

print(dp[n][nx]-1)

Buggy python submission (verdict: Time Limit Exceeded):

n,a=map(int,input().split())
x=list(map(int,input().split()))

#n=4
#a=8
#x=[7,9,8,9]

#n=8
#a=5
#x=[3,6,2,8,7,6,5,9]

for i in range(n):
    x[i]=x[i]-a
    
n2=n//2
n3=n-n2

y=[]
for i in range(n3):
    y.append(x[i+n2])

xsum=dict()
for i in range(2 ** n2):
    isum=0
    for j in range(n2):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            isum=isum+x[j]
    if isum in xsum:
        xsum[isum]=xsum[isum]+1
    else:
        xsum[isum]=1
#print(xsum)        
    
icnt=0
for i in range(2 ** n3):
    isum=0
    for j in range(n3):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            isum=isum+y[j]
#    print(isum)
    for xs in xsum.items():
        if xs[0]==-isum:
            icnt=icnt+(xs[1])
#            print(isum,xs[1],(xs[1]),icnt)

print(icnt-1)


Fixed submission:
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

print(dp[n][nx]-1)

Buggy python submission (verdict: Time Limit Exceeded):

n,a=map(int,input().split())
x=list(map(int,input().split()))

#n=4
#a=8
#x=[7,9,8,9]

#n=8
#a=5
#x=[3,6,2,8,7,6,5,9]

for i in range(n):
    x[i]=x[i]-a
    
n2=n//2
n3=n-n2

y=[]
for i in range(n3):
    y.append(x[i+n2])

# itertools 使用 bit全探索
import itertools

xsum=dict()
for i in itertools.product([0,1], repeat=n2):
    isum=0
    for ii in range(n2):
        if i[ii]==0:
            isum=isum+x[ii]
    if isum in xsum:
        xsum[isum]=xsum[isum]+1
    else:
        xsum[isum]=1
#xsum[0]=xsum[0]
#print(xsum)        
    
icnt=0
for i in itertools.product([0,1], repeat=n3):
    isum=0
    for ii in range(n3):
        if i[ii]==0:
            isum=isum+y[ii]
#    print(isum)
    for xs in xsum.items():
        if xs[0]==-isum:
            icnt=icnt+(xs[1])
#            print(isum,xs[1],(xs[1]),icnt)

print(icnt-1)

Fixed submission:
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

print(dp[n][nx]-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,a=map(int,input().split())
x=list(map(int,input().split()))

#n=4
#a=8
#x=[7,9,8,9]

#n=8
#a=5
#x=[3,6,2,8,7,6,5,9]

for i in range(n):
    x[i]=x[i]-a
    
n2=n//2
n3=n-n2

y=[]
for i in range(n3):
    y.append(x[i+n2])

# itertools 使用 bit全探索
import itertools

xsum=dict()
for i in itertools.product([0,1], repeat=n2):
    isum=0
    for ii in range(n2):
        if i[ii]==0:
            isum=isum+x[ii]
    if isum in xsum:
        xsum[isum]=xsum[isum]+1
    else:
        xsum[isum]=1
xsum[0]=xsum[0]-1*0
#print(xsum)        
    
icnt=0
for i in itertools.product([0,1], repeat=n3):
    isum=0
    for ii in range(n3):
        if i[ii]==0:
            isum=isum+y[ii]
#    print(isum)
    for xs in xsum.items():
        if xs[0]==-isum:
            icnt=icnt+(xs[1])
#            print(isum,xs[1],(xs[1]),icnt)

print(icnt-1)

Fixed submission:
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

print(dp[n][nx]-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,a=map(int,input().split())
x=list(map(int,input().split()))

#n=4
#a=8
#x=[7,9,8,9]

#n=8
#a=5
#x=[3,6,2,8,7,6,5,9]

for i in range(n):
    x[i]=x[i]-a
    
n2=n//2
n3=n-n2

y=[]
for i in range(n3):
    y.append(x[i+n2])

# itertools 使用 bit全探索
import itertools

xsum=[]
for i in itertools.product([0,1], repeat=n2):
    isum=0
    for ii in range(n2):
        if i[ii]==0:
            isum=isum+x[ii]
    xsum.append(isum)
    
icnt=0
for ix in range(len(xsum)):
    for i in itertools.product([0,1], repeat=n3):
        isum=0
        for ii in range(n3):
            if i[ii]==0:
                isum=isum+y[ii]
#        print(isum,xsum[ix])
        if isum==-xsum[ix]:
            icnt=icnt+1

print(icnt-1)

Fixed submission:
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

print(dp[n][nx]-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
# itertools 使用 bit全探索
import itertools
icnt=0
for i in itertools.product([0,1], repeat=n):
    isum=0
    for ii in range(n):
#        if i[ii]==0:
        isum=isum+x[ii]*i[ii]
    if isum==0:
        icnt=icnt+1

print(icnt-1)

Fixed submission:
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

print(dp[n][nx]-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
# itertools 使用 bit全探索
import itertools
icnt=0
for i in itertools.product([0,1], repeat=n):
    isum=0
    for ii in range(n):
        if i[ii]==0:
            isum=isum+x[ii]
    if isum==0:
        icnt=icnt+1

print(icnt-1)

Fixed submission:
n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

print(dp[n][nx]-1)