a,b=gets.chomp.split.map(&:to_i)
x=gets.chomp.split.map(&:to_i)
z=0
ans=[]
for i in 1..a do
    y=x.each_cons(i).to_a.map{|k|k.sum()}
    ans=ans+y
end

for j in ans do
    if j%b ==0 then
        z = z+1
    end
end
puts z
