main = do
  [n, k] <- map read . words <$> getLine
  let m = n * (n - 1) `div` 2 - k
  if (n - 1) * (n - 2) < 2 * k then print (-1)
  else print m >>
    (mapM_ putStrLn $ take m [show i ++ " " ++ show j | i <- [1 .. n - 1], j <- [2 .. n], i < j])