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

max_k = (N - 1) * (N - 2) / 2
if K > max_k
  puts -1
  exit
end

m = N - 1 + max_k - K
puts m
2.upto(N) do |i|
  puts "1 #{i}"
end
(max_k - K).times do |j|
  puts "#{j + 2} #{j + 3}"
end
