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
    }

    val width = n - m + 1

    @tailrec
    def traverse(ax: Int, ay: Int): Boolean = {
      @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)
      }
      ay < width && (fit(0, 0) || traverse((ax + 1) % width, ay + (ax + 1) / width))
    }

    if (traverse(0, 0)) {
      out.println("Yes")
    } else {
      out.println("No")
    }

    out.flush()
  }
}
