#include <bits/stdc++.h>
using namespace std;
char a[3010][3010], b[3010][3010];
long long n, m, f1[3010], f2[3010];
long long tmp, sum;
void Hsh(char c) { tmp = (tmp * 127 + (c - 'a')) % 99873309; }
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) cin >> b[i][j];
  for (int i = 0; i <= n - m; i++) {
    sum = 0;
    for (int j = i + 1; j <= i + m; j++) {
      tmp = 0;
      for (int k = 1; k <= m; k++) Hsh(a[j][k]);
      sum = (sum * 107 + tmp) % 99873309;
    }
    f1[i] = sum;
  }
  for (int i = 0; i <= n - m; i++) {
    sum = 0;
    for (int j = 1; j <= m; j++) {
      tmp = 0;
      for (int k = i + 1; k <= i + m; k++) Hsh(b[j][k]);
      sum = (sum * 107 + tmp) % 99873309;
    }
    f2[i] = sum;
  }
  for (int i = 0; i <= n - m; i++)
    for (int j = 0; j <= n - m; j++)
      if (f1[i] == f2[j]) {
        printf("%d %d", i + 1, j + 1);
        return 0;
      }
}
