import Control.Applicative
import Text.Printf

main :: IO ()
main = do
  xs <- (map read . words) <$> getLine
  if xs !! 0 == 0 && xs !! 1 == 0 then return ()
    else do {
    putStrLn $ take (xs !! 1) (repeat '#');
    putStr $ solve xs;
    putStrLn $ take (xs !! 1) (repeat '#');
    putStrLn $ "";
    main;
    }

solve :: [Int] -> String
solve xs
  | h == 2 = ""
  | otherwise = "#" ++ (take (w - 2) (repeat '.')) ++ "#\n" ++ solve ((h - 1) : w : []) 
  where h = xs !! 0
        w = xs !! 1