#include <bits/stdc++.h>
using namespace std;
unsigned long long pw[2005], base = 13331, base2 = 237;
void preCalc() {
  pw[0] = 1;
  for (int i = 1; i < 2005; i++) pw[i] = (pw[i - 1] * base);
}
string s2[205];
unsigned long long H[205][2005], H1[2005], savedH[2005][2005];
void setHash(int m) {
  for (int i = 0; i < m; i++) {
    H[i][0] = 0;
    s2[i] = "#" + s2[i];
    for (int j = 1; j < s2[i].size(); j++)
      H[i][j] = H[i][j - 1] * base + s2[i][j];
  }
}
unsigned long long getHash(int m, int l, int r) {
  unsigned long long hashValue = 0;
  for (int i = 0; i < m; i++)
    hashValue = hashValue * base2 + (H[i][r] - (H[i][l - 1] * pw[r - l + 1]));
  return hashValue;
}
unsigned long long Hasher(string s) {
  unsigned long long hashValue = 0;
  for (int i = 0; i < s.size(); i++) hashValue = hashValue * base + s[i];
  return hashValue;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  preCalc();
  int n, m;
  cin >> n >> m;
  string s1;
  for (int i = 0; i < n; i++) {
    cin >> s1;
    H1[i] = Hasher(s1);
  }
  for (int j = 0; j < m; j++) cin >> s2[j];
  setHash(m);
  for (int j = 1; j + m - 1 <= n; j++) {
    int l = j, r = j + m - 1;
    savedH[l][r] = getHash(m, l, r);
  }
  for (int i = 0; i + m <= n; i++) {
    unsigned long long hashValue = 0;
    for (int j = i; j < i + m; j++) hashValue = hashValue * base2 + H1[j];
    for (int j = 1; j + m - 1 <= n; j++) {
      int l = j, r = j + m - 1;
      if (savedH[l][r] == hashValue) {
        cout << i + 1 << " " << j << endl;
        return 0;
      }
    }
  }
}
