#include using namespace std; int N, M; int main(void){ ios::sync_with_stdio(false); cin.tie(0); cin >> N >> M; for(int i = 0;i < 1 << N;i++){ for(int j = 0;j < 1 << M;j++){ cout << (i << M | j) << " \n"[j + 1 == (1 << M)]; } } return 0; }