N, K = map(int, input().split())
abs_g = [(i, j) for i in range(1, N) for j in range(i + 1, N + 1)][::-1]

if len(abs_g) - (N - 1) < K:
    print(-1)
    exit()

print(len(abs_g) - K)
[print(i, j) for i, j in abs_g[K:]] N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K (i, j) for i in range(1, N) for j in range(i + 1, N + 1) for i in range(1, N) for j in range(i + 1, N + 1) i range(1, N) range 1 N for j in range(i + 1, N + 1) j range(i + 1, N + 1) range i + 1 i 1 N + 1 N 1 for j in range(i + 1, N + 1) (i, j) i j abs_g = [(i, j) for i in range(1, N) for j in range(i + 1, N + 1)][::-1] abs_g [(i, j) for i in range(1, N) for j in range(i + 1, N + 1)][::-1] [(i, j) for i in range(1, N) for j in range(i + 1, N + 1)] ::-1 -1 if len(abs_g) - (N - 1) < K:
    print(-1)
    exit() len(abs_g) - (N - 1) < K len(abs_g) - (N - 1) len(abs_g) len abs_g N - 1 N 1 K print(-1) print -1 exit() exit print(len(abs_g) - K) print len(abs_g) - K len(abs_g) len abs_g K print(i, j) for i, j in abs_g[K:] for i, j in abs_g[K:] i j abs_g[K:] abs_g K: K for i, j in abs_g[K:] print(i, j) print i j [print(i, j) for i, j in abs_g[K:]] abs_g = [(i, j) for i in range(1, N) for j in range(i + 1, N + 1)][::-1] [(i, j) for i in range(1, N) for j in range(i + 1, N + 1)][::-1] abs_g N, K = map(int, input().split()) map(int, input().split()) N K = map(int, input().split()) map(int, input().split()) K
N, K = map(int, input().split())
abs_g = [(i, j) for i in range(1, N) for j in range(i + 1, N + 1)][::-1]

if len(abs_g) - (N - 1) < K:
    print(-1)
    exit()

print(len(abs_g) - K)
[print(i, j) for i, j in abs_g[K:]]
