box_len, num_ch = gets.split(' ').map(&:to_i)
boxes = gets.split(' ').map(&:to_i)
result = 0

(0...boxes.length).each do |l_pntr|
  sum = 0
  (l_pntr...boxes.length).each do |r_pntr|
    sum += boxes[r_pntr]
    result += 1 if sum % num_ch == 0
  end
end
puts result


