#include <bits/stdc++.h>
using namespace std;
const int maxx = 600010;
const double pi = acos(-1.0);
const double eps = 1e-15;
map<pair<long long, long long>, int> h;
int t, n, m;
long long a1 = 0, a2 = 0, ans = 0, total = 0, s1 = 0, s2 = 0, cnt = 0, r1 = 0,
          r2 = 0, p1 = 0, p2 = 0;
char c1[3111][3111], c2[3111][3111];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf(" %c", &c1[i][j]);
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) scanf(" %c", &c2[i][j]);
  for (int i = 1; i <= n - m + 1; i++) {
    a1 = a2 = 0;
    for (int j = 1; j <= m; j++)
      for (int k = 1; k <= m; k++)
        a1 = (a1 * 237 % 998244353 + c1[k + i - 1][j] - 'a' + 1) % 998244353,
        a2 = (a2 * 237 % 1000000007 + c1[k + i - 1][j] - 'a' + 1) % 1000000007;
    h[make_pair(a1, a2)] = i;
  }
  a1 = a2 = 0, p1 = p2 = 1;
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= m - 1; j++)
      p1 = p1 * 237 % 998244353, p2 = p2 * 237 % 1000000007;
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= m; j++)
      a1 = (a1 * 237 % 998244353 + c2[j][i] - 'a' + 1) % 998244353,
      a2 = (a2 * 237 % 1000000007 + c2[j][i] - 'a' + 1) % 1000000007;
  if (h.count(make_pair(a1, a2)))
    printf("%d 1", h[make_pair(a1, a2)]);
  else {
    for (int i = 1; i <= n - m; i++) {
      long long u1 = p1, u2 = p2;
      for (int j = m; j >= 1; j--) {
        a1 = ((a1 - (c2[j][i] - 'a' + 1) * u1 % 998244353) % 998244353 +
              998244353) %
             998244353,
        a2 = ((a2 - (c2[j][i] - 'a' + 1) * u2 % 1000000007) % 1000000007 +
              1000000007) %
             1000000007;
        u1 = u1 * 237 % 998244353, u2 = u2 * 237 % 1000000007;
      }
      for (int j = 1; j <= m; j++)
        a1 = (a1 * 237 % 998244353 + c2[j][i + m] - 'a' + 1) % 998244353,
        a2 = (a2 * 237 % 1000000007 + c2[j][i + m] - 'a' + 1) % 1000000007;
      if (h.count(make_pair(a1, a2))) {
        printf("%d %d", h[make_pair(a1, a2)], i + 1);
        return 0;
      }
    }
  }
  return 0;
}
