n,m = map(int,input().split()) a = 0 m2 = 2 ** m for i in range(2**n): t = [] for j in range(2**m): t.append(a+j) print(*t) a += m2