n,k = map(int,input().split())
if k>(n-1)*(n-2)//2:
    print(-1)
else:
    print((n-1) + ((n-1)*(n-2)//2-k))
    for i in range(2, n+1):
        print(1, i)
    rem = (n-1)*(n-2)//2 - k
    cnt = 0
    for i in range(2, n+1):
        if cnt == rem:
            break
        for j in range(i+1, n+1):
            cnt += 1
            print(i, j)
            if cnt == rem:
                break n,k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k if k>(n-1)*(n-2)//2:
    print(-1)
else:
    print((n-1) + ((n-1)*(n-2)//2-k))
    for i in range(2, n+1):
        print(1, i)
    rem = (n-1)*(n-2)//2 - k
    cnt = 0
    for i in range(2, n+1):
        if cnt == rem:
            break
        for j in range(i+1, n+1):
            cnt += 1
            print(i, j)
            if cnt == rem:
                break k>(n-1)*(n-2)//2 k (n-1)*(n-2)//2 (n-1)*(n-2) n-1 n 1 n-2 n 2 2 print(-1) print -1 print((n-1) + ((n-1)*(n-2)//2-k)) print (n-1) + ((n-1)*(n-2)//2-k) n-1 n 1 (n-1)*(n-2)//2-k (n-1)*(n-2)//2 (n-1)*(n-2) n-1 n 1 n-2 n 2 2 k for i in range(2, n+1):
        print(1, i)
     i range(2, n+1) range 2 n+1 n 1 print(1, i) print 1 i rem = (n-1)*(n-2)//2 - k rem (n-1)*(n-2)//2 - k (n-1)*(n-2)//2 (n-1)*(n-2) n-1 n 1 n-2 n 2 2 k cnt = 0 cnt 0 for i in range(2, n+1):
        if cnt == rem:
            break
        for j in range(i+1, n+1):
            cnt += 1
            print(i, j)
            if cnt == rem:
                break i range(2, n+1) range 2 n+1 n 1 if cnt == rem:
            break
         cnt == rem cnt rem break for j in range(i+1, n+1):
            cnt += 1
            print(i, j)
            if cnt == rem:
                break j range(i+1, n+1) range i+1 i 1 n+1 n 1 cnt += 1 cnt 1 print(i, j) print i j if cnt == rem:
                break cnt == rem cnt rem break rem = (n-1)*(n-2)//2 - k (n-1)*(n-2)//2 - k rem cnt += 1 1 cnt cnt = 0 0 cnt k = map(int,input().split()) map(int,input().split()) k n,k = map(int,input().split()) map(int,input().split()) n
n,k = map(int,input().split())
if k>(n-1)*(n-2)//2:
    print(-1)
else:
    print((n-1) + ((n-1)*(n-2)//2-k))
    for i in range(2, n+1):
        print(1, i)
    rem = (n-1)*(n-2)//2 - k
    cnt = 0
    for i in range(2, n+1):
        if cnt == rem:
            break
        for j in range(i+1, n+1):
            cnt += 1
            print(i, j)
            if cnt == rem:
                break