n, s = gets.split.map(&:to_i)
a = (1..n).map { gets.to_i }
k = 0
j = n - 1
(0..n-2).each do |i|
    j -= 1 until a[i] + a[j] <= s or i >= j
    if i >= j
        k += n - i - 1
    else
        k += n - j - 1
    end
end
p k

