H,W=gets.split.map(&:to_i) S=Array.new(H) for i in 0...H do S[i]=gets.chomp end CAN=false for i in 0...H do for j in 0...W do next if i==0 && j==0 COIN=true T=Array.new(H).map{Array.new(W,0)} for ii in 0...H do for jj in 0...W do T[ii][jj]=1 if S[ii][jj]=='#' end end for ii in 0...H do for jj in 0...W do if T[ii][jj]==1 if ii+i>=H || jj+j>=W COIN=false next end COIN=false if T[ii+i][jj+j]!=1 T[ii][jj]=0 T[ii+i][jj+j]=0 end end end CAN=true if COIN end end puts CAN ? "YES":"NO"