def main1(h,w,s): ary=[] for i in range(h): for j in range(w): if s[i][j]=="#": ary.append((i,j)) if len(ary)%2==1:return False # 平行移動のパターンはH*W-1 # すべて試す for i in range(h): for j in range(w): if i==0 and j==0:continue ary_st=set(ary) flg=True while ary_st: x,y=ary_st.pop() if (x+i,y+j) in ary_st: ary_st.discard((x+i,y+j)) else: flg=False break if flg: return True return False if __name__=='__main__': h,w=map(int,input().split()) s=[input() for _ in range(h)] ret1=main1(h,w,s) if ret1: print("YES") else: print("NO")