loop do
    n, s = gets.split.map(&:to_i)
    break if n == 0
    a = (1..n).map { gets.to_i }.sort
    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
end

