using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            MyInputStream cin = new MyInputStream();

            var N = cin.ReadInt();
            var M = cin.ReadInt();

            var img1 = new int[N, N];
            var img2 = new int[M, M];

            for (int i = 0; i < N; ++i)
            {
                for (int j = 0; j < N; ++j)
                    img1[i, j] = Read();
                Read();
            }

            for (int i = 0; i < M; ++i)
            {
                for (int j = 0; j < M; ++j)
                    img2[i, j] = Read();
                Read();
            }

            for (int i = 0; i < N - M + 1; ++i)
            {
                for (int j = 0; j < N - M + 1; ++j)
                {
                    var flag = true;
                    for (int k = 0; flag && k < M; ++k)
                    {
                        for (int l = 0; flag && l < M; ++l)
                        {
                            if (img1[i + k, j + l] != img2[k, l])
                            {
                                //WriteLine($"({i + k}, {j + l}):[{(char)img1[i+k, j+l]}]  ({k}, {l}):[{(char)img2[k, l]}]");
                                flag = false;
                            }
                        }
                    }
                    if (flag)
                    {
                        WriteLine("Yes");
                        return;
                    }
                }
            }
            WriteLine("No");
        }
    }

    public static class MyExtensions
    {
        public static string Reverse(this string sourse)
        {
            char[] chrAry = sourse.ToCharArray();
            Array.Reverse(chrAry);
            return new string(chrAry);
        }
    }

    public class MyInputStream
    {
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(char separator = ' ')
        {
            this.separator = separator;
            inputStream = new Queue<string>();
        }

        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = Console.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; i++)
            {
                inputStream.Enqueue(tmp[i]);
            }
            return inputStream.Dequeue();
        }
        public string ReadLine() => Console.ReadLine();
        public int ReadInt() => int.Parse(Read());
        public long ReadLong() => long.Parse(Read());
        public double ReadDouble() => double.Parse(Read());
    }

    public class Pair<T1, T2>
    {
        public T1 First;
        public T2 Second;
        public Pair() { First = default(T1); Second = default(T2); }
        public Pair(T1 f, T2 s) { First = f; Second = s; }
        public override string ToString() { return "(" + First + ", " + Second + ")"; }
        public override int GetHashCode() { return First.GetHashCode() ^ Second.GetHashCode(); }
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(this, obj)) return true;
            else if (obj == null) return false;
            var tmp = obj as Pair<T1, T2>;
            return (object)tmp != null && First.Equals(tmp.First) && Second.Equals(tmp.Second);
        }
    }

    #region HashMap
    public class HashMap<K, V> : Dictionary<K, V>
    {
        public HashMap() : base() { }
        public HashMap(int cap) : base(cap) { }
        public HashMap(IDictionary<K, V> dictionary) : base(dictionary) { }
        new public V this[K i]
        {
            get
            {
                V v;
                return TryGetValue(i, out v) ? v : base[i] = default(V);
            }
            set { base[i] = value; }
        }
    }
    #endregion
}


Measured memory_bytes: 11316