n, m = gets.not_nil!.split.map(&.to_i)
a = gets.not_nil!.split.map(&.to_i)
j = 1
count = 0.to_i64
a.each do |i|
	temp = i
	if temp%2 == 0
		count += 1
	end
	k = j
	while k < n
		temp += a[k]
		if temp%2 == 0
			count += 1
		end
		k += 1
	end
	j += 1
end
puts count