N,K = gets.split.map &:to_i
M = (N-1)*(N-2)/2
if K > M
  p -1; exit
end

def r
  g = []
  (2..N).each{ |v| g << "1 #{v}" }

  k = M - K
  (2..N).each{ |u|
    (u+1..N).each{ |v|
      return g if k <= 0
      k -= 1
      g << "#{u} #{v}"  
    }
  }
  g
end

G = r
puts G.size, G
