object Main {
  def main(args:Array[String]){
    val sc=new java.util.Scanner(System.in)
    var tmp=false
    println()
      while(true){
       val h,w=sc.nextInt
       if(h==0&&w==0) return
       if(tmp) println()
       for(i<-1 to h;j<-1 to w){
         if(j==w) println("#")
         else print("#")
       }
       tmp=true
     }
  }
}