#!/usr/bin/env ruby

word = []
numbers = []
sharp = "#"
i = 0

loop do 
    word = gets.split.map(&:to_i)
    if word[0] == 0 and word[1] == 0 then; break; end
    word.each do |key|
        numbers << key
    end
end

((numbers.count + 1) / 2).times do
    numbers[i].times do  
        puts sharp * numbers[i + 1]
    end
    puts ""
    i += 2 
end
