loop do
    n, s = gets.split.map(&:to_i)
    break if n == 0
    rs = (1..n).map { gets.to_i }

    if n == 1
        puts 0
        next
    end 

    i = 0 
    j = n - 1 
    num = 0 
    loop do
        j -= 1 until j <= i || rs[i] + rs[j] < s 
        j += 1
        num += n - j 
        break if j == i + 1 
        i += 1
break if i == j
    end 
    p num 
end