n, k = map(int,input().split())
x = (n-2)*(n-1)//2

if k > x:
    print(-1)
    exit()

ans = []
for i in range(2, n+1):
    ans.append([1, i])
i = 2
j = 3
while k < x:
    ans.append([i, j])
    if j < n:
        j += 1
    else :
        i += 1
        j = i+1
    x -= 1 

print(len(ans))
for i in range(len(ans)):
    b = [str(i) for i in ans[i]]
    print(' '.join(b)) n, k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k x = (n-2)*(n-1)//2 x (n-2)*(n-1)//2 (n-2)*(n-1) n-2 n 2 n-1 n 1 2 if k > x:
    print(-1)
    exit() k > x k x print(-1) print -1 exit() exit ans = [] ans [] for i in range(2, n+1):
    ans.append([1, i]) i range(2, n+1) range 2 n+1 n 1 ans.append([1, i]) ans.append ans append [1, i] 1 i i = 2 i 2 j = 3 j 3 while k < x:
    ans.append([i, j])
    if j < n:
        j += 1
    else :
        i += 1
        j = i+1
    x -= 1  k < x k x ans.append([i, j]) ans.append ans append [i, j] i j if j < n:
        j += 1
    else :
        i += 1
        j = i+1
     j < n j n j += 1 j 1 i += 1 i 1 j = i+1 j i+1 i 1 x -= 1 x 1 print(len(ans)) print len(ans) len ans for i in range(len(ans)):
    b = [str(i) for i in ans[i]]
    print(' '.join(b)) i range(len(ans)) range len(ans) len ans str(i) for i in ans[i] for i in ans[i] i ans[i] ans i for i in ans[i] str(i) str i b = [str(i) for i in ans[i]] b [str(i) for i in ans[i]] print(' '.join(b)) print ' '.join(b) ' '.join ' ' join b k = map(int,input().split()) map(int,input().split()) k i = 2 2 i b = [str(i) for i in ans[i]] [str(i) for i in ans[i]] b ans = [] [] ans j += 1 1 j n, k = map(int,input().split()) map(int,input().split()) n x = (n-2)*(n-1)//2 (n-2)*(n-1)//2 x i += 1 1 i x -= 1 1 x j = i+1 i+1 j j = 3 3 j
n, k = map(int,input().split())
x = (n-2)*(n-1)//2

if k > x:
    print(-1)
    exit()

ans = []
for i in range(2, n+1):
    ans.append([1, i])
i = 2
j = 3
while k < x:
    ans.append([i, j])
    if j < n:
        j += 1
    else :
        i += 1
        j = i+1
    x -= 1 

print(len(ans))
for i in range(len(ans)):
    b = [str(i) for i in ans[i]]
    print(' '.join(b))