#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  vector<string> A(n), B(m);
  for (auto& s : A) cin >> s;
  for (auto& s : B) cin >> s;
  for (int i = 0; i < n; i++) {
    int pos = -1;
    while (pos + 1 < n) {
      bool ok = 1;
      pos = B[0].find(A[i], pos + 1);
      if (pos == -1) break;
      for (int k = m - 1; k >= 0 && ok; k--)
        if (A[i + k] != B[k].substr(pos, m)) ok = 0;
      if (ok) return cout << i + 1 << " " << pos + 1 << "\n", 0;
    }
  }
  cout << -1;
}
