input = gets.chomp.split(' ').map { |v| v.to_i }
n = input[0]
m = input[1]

boxes = gets.chomp.split(' ').map { |v| v.to_i }
#boxes.sort! { |a, b| b <=> a }

count = 0
#p boxes

for i in 0...boxes.length
    flag = false
    for j in i...boxes.length
        sum = 0
        for k in i..j
            sum += boxes[k]
        end
        
        if j == (boxes.length - 1) && sum < m
            flag = true
            break
        end
        
        if sum % m == 0
            #p sum
            count += 1
        end
    end
    
    if flag
        break
    end
end

puts count