#!/usr/bin/env PyPy3 from collections import Counter, defaultdict, deque import itertools import re import math from functools import reduce import operator import bisect from heapq import * import functools mod=998244353 import sys input=sys.stdin.readline n,h=map(int,input().split()) def divisor(n): sq = n**0.5 border = int(sq) table = [] bigs = [] for small in range(1, border+1): if n%small == 0: table.append(small) big = n//small bigs.append(big) if border == sq:#nが平方数 bigs.pop() table += reversed(bigs) return table ta = divisor(n) ans = [[0] * (n // h) for _ in range(h)] if h & -h == h: i = j = 0 k = 0 while j < h: c = ta[k] while c: ans[j][i] = ta[k] c -= 1 i += 1 if i == n // h: i = 0 j += 1 k += 1 else: i = j = 0 k = 0 while i < n // h: c = ta[k] while c: ans[j][i] = ta[k] c -= 1 j += 1 if j == h: i += 1 j = 0 k += 1 for i in range(h): print(*ans[i])