import Data.List
import Data.List.Split


main = do
  input <- getSplitedLines
  let inputExceptLast = take (length input - 1) input
  mapM_ putStrLn $ map show $ map calc inputExceptLast

calc :: (Int,Int) -> Int
calc (n,x) = calc' 1 n x
  where
    calc' s n x 
      | s == x = 1
	  | s >  x = 0
	  | s <  x = sum $ map (\s' -> calc' (s' + 1) n' (x - s')) [s..n'] 
	  where
	    n' = if n > x then x else n

toTuple (a:b:_) = (a,b)

getSplitedLines =  do
  s <- getContents
  return $ map toTuple $ map (map read) $ map (splitOn " ") $ lines s

