#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2010, MAX_M = 210;
const unsigned long long h = 127;
map<unsigned long long, int> pos;
int n, m;
string tab1[MAX_N];
string tab2[MAX_N];
unsigned long long hash1[MAX_N], hash2[MAX_N], step[MAX_M * MAX_M];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    tab1[i].resize(m);
  }
  for (int i = 0; i < m; i++) {
    tab2[i].resize(n);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> tab1[i][j];
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      cin >> tab2[i][j];
    }
  }
  step[0] = 1;
  for (int i = 1; i < MAX_M * MAX_M; i++) {
    step[i] = step[i - 1] * h;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      hash1[i] *= h;
      hash1[i] += (unsigned long long)tab1[i][j];
    }
  }
  unsigned long long curr = 0;
  for (int i = 0; i < m; i++) {
    curr *= step[m];
    curr += hash1[i];
  }
  for (int i = m; i < n; i++) {
    pos[curr] = i + 1 - m;
    curr -= step[m * m - m] * hash1[i - m];
    curr *= step[m];
    curr += hash1[i];
  }
  pos[curr] = n - m + 1;
  curr = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      hash2[i] *= step[m];
      hash2[i] += (unsigned long long)tab2[j][i];
    }
  }
  for (int i = 0; i < m; i++) {
    curr *= h;
    curr += hash2[i];
  }
  for (int i = m; i < n; i++) {
    if (pos.find(curr) != pos.end()) {
      cout << pos[curr] << " " << i + 1 - m << "\n";
      return 0;
    }
    curr -= step[m - 1] * hash2[i - m];
    curr *= h;
    curr += hash2[i];
  }
  if (pos.find(curr) != pos.end()) {
    cout << pos[curr] << " " << n + 1 - m << "\n";
    return 0;
  }
  return 0;
}
