#include<bits/stdc++.h>                                                       
using namespace std;                                                          
#define endl '\n'                                                             
#define pb push_back                                                          
#define all(x) x.begin(), x.end()                                             
#define rep(i, n) for (int i = 0; i < n; ++i)                                 
#define reps(i, m, n) for (int i = m; i <= n; ++i)                            
typedef long long ll;                                                         
typedef vector<int> vi;                                                       
typedef vector<ll> vl;                                                        
typedef pair<int, int> pii;                                                   
typedef pair<ll, ll> pll;                                                     
const int INF = 0x3f3f3f3f;                                                   
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;                                         
                                                                              
signed main()                                                                 
{                                                                             
  cin.tie(0); ios::sync_with_stdio(false);                                    
                                                                              
  int N, M; cin >> N >> M;                                                    
  char A[55][55];                                                             
  char B[55][55];                                                             
                                                                              
  rep(i, N) {                                                                 
    rep(j, N) {                                                               
      cin >> A[i][j];                                                         
    }                                                                         
  }                                                                           
                                                                              
  rep(i, M) {                                                                 
    rep(j, M) {                                                               
      cin >> B[i][j];                                                         
    }                                                                         
  }                                                                           
                                                                              
  bool isEx = false;                                                          
  for (int i = 0; i < N; ++i) {                                               
    for (int j = 0; j < N; ++j) {                                             
      if (i + M - 1 >= N || j + M - 1 >= N) continue;                         
                                                                              
      bool isMatch = true;                                                    
      for (int k = 0; k < M; ++k) {                                           
        for (int l = 0; l < M; ++l) {                                         
          if (A[i+k][j+l] != B[k][l]) isMatch = false;                        
        }                                                                     
      }                                                                       
                                                                              
      if (isMatch) isEx = true;                                               
    }                                                                         
  }                                                                           
                                                                              
  cout << (isEx ? "Yes" : "No") << endl;                                      
                                                                              
  return 0;                                                                   
}                                                                             

Measured memory_bytes: 256