import sys input = sys.stdin.readline def iinput(): return int(input()) def sinput(): return input().rstrip() def i0input(): return int(input()) - 1 def linput(): return list(input().split()) def liinput(): return list(map(int, input().split())) def miinput(): return map(int, input().split()) def li0input(): return list(map(lambda x: int(x) - 1, input().split())) def mi0input(): return map(lambda x: int(x) - 1, input().split()) INF = 10**20 MOD = 1000000007 def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] N, H = liinput() W = N // H ans = [[0] * W for _ in [0] * H] if W > H: ctr = 0 ctr2 = 0 for k in make_divisors(N)[::-1][1:]: if k >= W: while ctr * W < k: for j in range(W): ans[ctr][j] = k ctr += 1 else: j = 0 while j < k: ans[-1][ctr2] = k ctr2 += 1 j += 1 else: ctr = 0 ctr2 = 0 for k in make_divisors(N)[::-1][1:]: if k >= H: i = 0 while i * H < k: for j in range(H): ans[j][ctr] = k ctr += 1 i += 1 else: j = 0 while j < k: ans[ctr2][-1] = k ctr2 += 1 j += 1 for a in ans: print(*a)