read N M
read -d ""
REPLY=`echo "${REPLY}" | sed -e 's/\./@/g'`
A=`echo "${REPLY}" | sed -n 1,${N}p`
B=`echo "${REPLY}" | sed -n $((N + 1)),$((N + M))p`

b_1=`echo "${B}" | sed -n 1p`
b_byte=`echo "${B}" | sed -n 1p | wc -c`

a_chk=`echo "${A}" | grep -n ${b_1} | awk -F: '{print $1}'`

if [ ! "${a_chk}" ]
then
	echo No
	exit
fi

for i in $a_chk
do
	CNT=1
	for A_LINE in `echo "${A}" | sed -n ${i},$((i + M - 1))p | sed -e "s/[${b_1}]//"`
	do
		B_LINE=`echo "${B}" | sed -n ${CNT}p`
		
		if [ `echo "${A_LINE}" | wc -c` -ne $b_byte ]
		then
			A_LINE=`echo "${A}" | sed -n ${i},$((i + M - 1))p | \
			sed -e "s/^${B_LINE}/$(printf %0$((b_byte - 1))d)/g" | \
			sed -e "s/[^$(printf %0$((b_byte - 1))d)]//g" | \
			sed -e "s/0/@/g" | sed -n ${CNT}p`
		fi
		
		if [ "${A_LINE}" != "${B_LINE}" ]
		then
			break
		fi
		CNT=$((CNT + 1))
	done
	
	if [ $CNT -eq $((M + 1)) ]
	then
		break
	fi
	
	if [ $i -eq $((N - M + 1)) ]
	then
		echo No
		exit
	fi
done
echo Yes
