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