N, K = gets.split.map(&:to_i)

x = (N - 1)*(N - 2) / 2
if K > x
  puts '-1'
else
  y = x - K
  puts N - 1 + y
  (N - 1).times{|i| puts "1 #{i + 2}"}
  [*2 .. N].each_cons(2).take(y).each{|a| puts a.join(' ')}
end