N, K = gets.split.map(&:to_i)
if K > N * (N - 1) / 2 - (N - 1)
  p -1
  exit
end
a = N * (N - 1) / 2 - (N - 1) - K
p a + N - 1
2.upto(N) do |i|
  puts "1 #{i}"
end
i = 2
j = 3
while a > 0
  puts "#{i} #{j}"
  a -= 1
  if j < N
    j += 1
  else
    i += 1
    j = i + 1
  end
end