n, k = map(int, input().split())
kmax = (n - 1) * (n - 2) // 2
if k > kmax:
    print(-1)
else:
    rest = kmax - k
    print(n - 1 + rest)
    for i in range(1, n):
        print(i, n)
    i, j = 1, 2
    while rest:
        print(i, j)
        j += 1
        if j == n:
            i += 1
            j = i + 1
        rest -= 1 n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k kmax = (n - 1) * (n - 2) // 2 kmax (n - 1) * (n - 2) // 2 (n - 1) * (n - 2) n - 1 n 1 n - 2 n 2 2 if k > kmax:
    print(-1)
else:
    rest = kmax - k
    print(n - 1 + rest)
    for i in range(1, n):
        print(i, n)
    i, j = 1, 2
    while rest:
        print(i, j)
        j += 1
        if j == n:
            i += 1
            j = i + 1
        rest -= 1 k > kmax k kmax print(-1) print -1 rest = kmax - k rest kmax - k kmax k print(n - 1 + rest) print n - 1 + rest n - 1 n 1 rest for i in range(1, n):
        print(i, n)
     i range(1, n) range 1 n print(i, n) print i n i, j = 1, 2 i 1 j 2 while rest:
        print(i, j)
        j += 1
        if j == n:
            i += 1
            j = i + 1
        rest -= 1 rest print(i, j) print i j j += 1 j 1 if j == n:
            i += 1
            j = i + 1
         j == n j n i += 1 i 1 j = i + 1 j i + 1 i 1 rest -= 1 rest 1 j = 1, 2 2 j j += 1 1 j k = map(int, input().split()) map(int, input().split()) k kmax = (n - 1) * (n - 2) // 2 (n - 1) * (n - 2) // 2 kmax rest = kmax - k kmax - k rest i, j = 1, 2 1 i j = i + 1 i + 1 j rest -= 1 1 rest n, k = map(int, input().split()) map(int, input().split()) n i += 1 1 i
n, k = map(int, input().split())
kmax = (n - 1) * (n - 2) // 2
if k > kmax:
    print(-1)
else:
    rest = kmax - k
    print(n - 1 + rest)
    for i in range(1, n):
        print(i, n)
    i, j = 1, 2
    while rest:
        print(i, j)
        j += 1
        if j == n:
            i += 1
            j = i + 1
        rest -= 1