#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int INF = 2e9 + 9;
const long long INF1 = 1e18 + 9;
const long long MAXN = 2e5 + 7;
const long long MAXN1 = 1 << 11;
const long long MAXN2 = 4e6 + 9;
const long long MOD = 998244353;
const long long MOD1 = 1e9 + 9;
const long long ALPH = 50;
const long long PW1 = 239;
const long long PW2 = 199;
const long long PW3 = 193;
const long long PW4 = 117;
const long double EPS = 1e-9;
const long long BLOCK = 3684;
const long long BLOCK1 = 1 << 9;
void solve();
signed main() {
  srand('a' + 'l' + 'e' + 'x' + 'X' + '5' + '1' + '2');
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q = 1;
  if (0) cin >> q;
  while (q--) solve();
}
bool correct[26][26][MAXN];
int zf[MAXN * 2], z[2 * MAXN];
void solve() {
  int n, m;
  string s, t;
  cin >> n >> m >> s >> t;
  int k = n + m + 1;
  for (int i = 0; i < m; ++i) z[i] = t[i] - 'a';
  z[m] = -1;
  for (int i = 0; i < n; ++i) z[m + i + 1] = s[i] - 'a';
  for (int i = 0; i < 26; ++i) {
    for (int j = 0; j < 26; ++j) {
      for (int r = 0, l = 0, q = 1; q < k; ++q) {
        zf[q] = 0;
        if (q <= r) {
          zf[q] = min(r - q + 1, zf[q - l]);
        }
        while (q + zf[q] < k && zf[q] < m &&
               (z[q + zf[q]] == (q + zf[q] >= m ? i : j) &&
                    z[zf[q]] == (zf[q] >= m ? i : j) ||
                z[q + zf[q]] != (q + zf[q] >= m ? i : j) &&
                    z[zf[q]] != (zf[q] >= m ? i : j))) {
          ++zf[q];
        }
        if (q + zf[q] - 1 > r) {
          r = q + zf[q] - 1;
          l = q;
        }
      }
      for (int q = 0; q < n; ++q) {
        correct[i][j][q] = zf[m + q + 1] == m;
      }
    }
  }
  vector<int> ind(26, -1), ans;
  vector<set<int>> in(26);
  for (int i = m - 1; i >= 0; --i) {
    ind[z[i]] = i;
  }
  for (int i = 0; i + m <= n; ++i) {
    bool b = 1;
    for (int j = 0; j < 26; ++j) {
      if (ind[j] != -1) {
        if (!correct[z[m + 1 + i + ind[j]]][j][i]) b = 0;
        in[z[m + 1 + i + ind[j]]].emplace(j);
        in[j].emplace(z[m + 1 + i + ind[j]]);
      }
    }
    for (int j = 0; j < 26; ++j) {
      if (in[j].size() > 1) b = 0;
      in[j].clear();
    }
    if (b) ans.emplace_back(i + 1);
  }
  cout << ans.size() << "\n";
  for (auto &i : ans) cout << i << " ";
}
