n, s = gets.split.map(&:to_i)
items = gets.split.map(&:to_i)

reso = []

for x in 0...items.length
  for y in x...items.length
    reso << [x, y] if items[x..y].inject(0){|a, b| a+b} == s
  end
end

sub = 0

for x in 0...items.length
  for y in x...items.length
    hoge = reso.select{|a| x <= a[0] && a[1] <= y}
    unless hoge.nil?
      sub += hoge.count
    end
  end
end

puts sub
