{-# OPTIONS_GHC -O2 #-}
import Control.Applicative
import Data.List
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BS
import Data.Maybe (fromJust)

show2 x y = shows x " " ++ show y

f :: [Int] -> [String]
f (n:k:_)
    | node < 0  = ["-1"]
    | otherwise = (show (node + n - 1)) : zipWith show2 (replicate (n-1) 1) [2..n] ++ take node [ show2 x y | x <- [2..(n `div`  2)] , y <- [n..(n `div` 2)]]
    where
      node = k - ((n-1) * (n-2) `div` 2)

main :: IO()
main = interact $ unlines . f . map read . words