### subroutines

def upper_bound(arr, key, i0 = 0, i1 = arr.length)
  lb = i0 - 1
  ub = i1

  while lb + 1 < ub
    m = (lb + ub) / 2
    if arr[m] > key
      ub = m
    else
      lb = m
    end
  end
  ub
end

### main

loop do
  n, s = gets.split.map(&:to_i)
  break if (n | s) == 0

  rs = n.times.map{gets.to_i}.sort

  count = 0

  for i in (0...(n - 1))
    rem = s - rs[i]
    if rem < rs[i + 1]
      count += n - 1 - i
    else
      j = upper_bound(rs, rem, i + 1, n)
      count += n - j
    end
  end

  puts count
end