def lscan; gets.split.map(&:to_i); end n, h = lscan div = (1..(n-1)).filter{|x| n/x*x == n}.to_a # p div if h >= 3 p -1 exit end la = div.pop # print (la.to_s + ' ')*la print [la.to_s]*la*' ' puts if h == 2 puts div.map{|d| [d.to_s]*d*' '}.flatten*' '