h, w = gets.split.map(&:to_i)
while h != 0 || w != 0 do
for b in 1..w do
	print "#"
end
puts
	for a in 3..h do
		print "#"
		for b in 3..w do
			print "."
		end
		print "#"
		puts
	end
	for b in 1..w do
	print "#"
end
puts
puts
h, w = gets.split.map(&:to_i)
end