#include <bits/stdc++.h>
using namespace std;
struct H {
  long long MOD, BASE;
  H(long long MOD, long long BASE) : MOD(MOD), BASE(BASE) {}
  long long fastpow(long long num, long long p) {
    if (p == 0) return 1;
    if (p & 1) return (num % MOD * fastpow(num, p - 1)) % MOD;
    long long a = fastpow(num, p / 2);
    return (a * a) % MOD;
  }
  long long removeAt(long long code, int idx, int val) {
    return (code - (val * fastpow(BASE, idx)) % MOD + MOD) % MOD;
  }
  long long addAt(long long code, int idx, int val) {
    return (code + (val * fastpow(BASE, idx)) % MOD) % MOD;
  }
  long long shiftLeft(long long code) { return (code * BASE) % MOD; }
} h1(2000000011ll, 53ll), h2(805306457ll, 10007ll);
int val(char c) { return c - 'a'; }
vector<int> computePrefix(vector<pair<long long, long long> > &pat,
                          vector<int> &longestPrefix) {
  int m = pat.size();
  for (int i = 1, k = 0; i < m; i++) {
    while (k > 0 && pat[k] != pat[i]) k = longestPrefix[k - 1];
    if (pat[k] == pat[i])
      longestPrefix[i] = ++k;
    else
      longestPrefix[i] = k;
  }
  return longestPrefix;
}
void KMP(vector<pair<long long, long long> > &str,
         vector<pair<long long, long long> > &pat, int fein) {
  int n = str.size(), m = pat.size();
  vector<int> longestPrefix(m);
  computePrefix(pat, longestPrefix);
  for (int i = 0, k = 0; i < n; i++) {
    while (k > 0 && pat[k] != str[i]) k = longestPrefix[k - 1];
    if (pat[k] == str[i]) k++;
    if (k == m) {
      cout << i - m + 2 << " " << fein << '\n';
      exit(0);
    }
  }
}
int n, m;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  vector<pair<long long, long long> > str;
  for (int j = 0; j < n; j++) {
    string s;
    cin >> s;
    long long h = 0, hz = 0;
    for (int i = 0; i < m; i++) {
      h = h1.shiftLeft(h);
      hz = h2.shiftLeft(h);
      h = h1.addAt(h, 0, val(s[i]));
      hz = h2.addAt(h, 0, val(s[i]));
    }
    str.push_back({h, hz});
  }
  vector<vector<pair<long long, long long> > > pat(m + 1);
  for (int j = 0; j < m; j++) {
    string s;
    cin >> s;
    long long h = 0, hz = 0;
    for (int i = 0; i < n; i++) {
      if (i >= m) {
        pat[j].push_back({h, hz});
        h = h1.removeAt(h, m - 1, val(s[i - m]));
        hz = h2.removeAt(h, m - 1, val(s[i - m]));
      }
      h = h1.shiftLeft(h);
      hz = h2.shiftLeft(h);
      h = h1.addAt(h, 0, val(s[i]));
      hz = h2.addAt(h, 0, val(s[i]));
    }
    pat[j].push_back({h, hz});
  }
  for (int i = 0; i < n - m + 1; i++) {
    vector<pair<long long, long long> > pt;
    for (int j = 0; j < m; j++) pt.push_back(pat[j][i]);
    KMP(str, pt, i + 1);
  }
}
