function main(input) {
  const args = input.split('\n');
  let ans = 'Yes';
  const ary1 = args[0].split(' ').map(n => parseInt(n, 10));
  const A = ary1[0];
  const B = ary1[1];
  const loop = (A >= B) ? B : A;
  
  //小さい方で回す
  for (let i = 1; i <= (loop); i++) {
    aryA = args[i].split(''); //A
    aryB = args[i + A].split(''); //B
    
    for(let j = 0; j <= (loop - 1); j++) {
      if (aryA[j] !== aryB[j]) ans = 'No';
    }
  }
  
  console.log(ans);
}

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