#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
const int N = 2000 + 10;
char a[N][N], b[N][N];
const int P = 1e7 + 19;
int p[N];
int main() {
  p[0] = 1;
  for (int i = 1; i < N; ++i) {
    p[i] = p[i - 1] * 26 % P;
  }
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%s", a[i]);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%s", b[i]);
  }
  vector<int> s(n);
  for (int i = 0; i < n; ++i) {
    int sum = 0;
    for (int j = 0; j < m; ++j) {
      int k = a[i][j] - 'a';
      sum = (sum * 26 + k) % P;
    }
    s[i] = sum;
  }
  vector<int> t(m);
  for (int i = 0; i < m; ++i) {
    int sum = 0;
    for (int j = 0; j < m; ++j) {
      int k = b[i][j] - 'a';
      sum = (sum * 26 + k) % P;
    }
    t[i] = sum;
  }
  vector<int> f(m);
  f[0] = 0;
  int k = 0;
  for (int i = 1; i < m; ++i) {
    for (; k > 0 && t[k] != t[i]; k = f[k - 1])
      ;
    if (t[k] == t[i]) k++;
    f[i] = k;
  }
  k = 0;
  for (int i = 0; i < n; ++i) {
    for (; k > 0 && t[k] != s[i]; k = f[k - 1])
      ;
    if (t[k] == s[i]) k++;
    if (k == m) {
      printf("%d %d\n", i - m + 2, 1);
      return 0;
    }
  }
  for (int j = m; j < n; ++j) {
    for (int i = 0; i < m; ++i) {
      t[i] = (t[i] + P - (b[i][j - m] - 'a') * p[m - 1] % P) % P;
      t[i] = (t[i] * 26 + (b[i][j] - 'a')) % P;
    }
    f[0] = 0;
    int k = 0;
    for (int i = 1; i < m; ++i) {
      for (; k > 0 && t[k] != t[i]; k = f[k - 1])
        ;
      if (t[k] == t[i]) k++;
      f[i] = k;
    }
    k = 0;
    for (int i = 0; i < n; ++i) {
      for (; k > 0 && t[k] != s[i]; k = f[k - 1])
        ;
      if (t[k] == s[i]) k++;
      if (k == m) {
        printf("%d %d\n", i - m + 2, j - m + 2);
        return 0;
      }
    }
  }
  puts("-1 -1");
  return 0;
}
