import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val Array(n, m) = in.readLine().split("\\s+").map(_.toInt)
    val as = Array.fill(n) {
      in.readLine().toCharArray
    }
    val bs = Array.fill(m) {
      in.readLine().toCharArray
    }

    for {
      ax <- 0 until n - m + 1
      ay <- 0 until n - m + 1
    } {
      @tailrec
      def fit(bx: Int, by: Int): Boolean = {
        by == m || as(ax + bx)(ay + by) == bs(bx)(by) && fit((bx + 1) % m, by + (bx + 1) / m)
      }
      if (fit(0, 0)) {
        out.println("Yes")
        out.flush()
        return
      }
    }

    out.println("No")
    out.flush()
  }
}
