N, M = map(int, input().split())

for i in range(1 << N):
    ans = [j + (1 << M) * i for j in range(1 << M)]
    print(*ans)