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

max_size = [*(1..(N - 2))].inject(0, &:+)

if K > max_size
  puts "-1"
  exit
end

ans = []
2.upto(N) { |n| ans << "1 #{n}" }
a = 2
b = 3
(max_size - K).times do
  ans << "#{a} #{b}"
  b += 1 
  if b > N
    a += 1
    b = a + 1
  end
end

ans.unshift([ans.size])

puts ans
