'use strict'

function main(s) {

  s = s.split('\n');

  const n = Number(s[0].split(' ')[0]);
  const m = Number(s[0].split(' ')[1]);

  const a = s.slice(1, 1 + n).map(l => l.split(''));
  const b = s.slice(1 + n, -1).map(l => l.split(''));

  const dx = [];
  const dy = [];
  for (let i = 0; i < m; i++) {
    for (let j = 0; j < m; j++) {
      dx.push(i);
      dy.push(j);
    }
  }

  let ans = false;

  for (let i = 0; i < n; i++) {
    for (let j = 0; j < n; j++) {
      
      for (let k = 0, len = Math.pow(m, 2); k < len; k++) {
        const ni = i + dx[k];
        const nj = j + dy[k];

        if (ni < 0 || n <= ni) break;
        if (nj < 0 || n <= nj) break;
        if (a[ni][nj] !== b[dx[k]][dy[k]]) break;

        if (k === (len - 1)) ans = true;
      }
    }
  }

  console.log(ans ? 'Yes' : 'No');
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
