#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
const int MOD = 1000000007;
long long PRIME = 200009;
int n, m;
long long ppow[MAXN];
int first[27], last1[27], last2[27];
int nxt[MAXN], prv[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s, t;
  cin >> n >> m;
  cin >> s >> t;
  memset(first, -1, sizeof(first));
  memset(last1, -1, sizeof(last1));
  memset(last2, -1, sizeof(last2));
  ppow[0] = 1;
  long long hs = 0, ht = 0;
  for (int i = 0; i < m; i++) {
    int v = t[i] - 'a';
    int v2 = s[i] - 'a';
    if (last1[v] == -1) {
      ht *= PRIME;
    } else
      ht = PRIME * ht + i - last1[v];
    if (last2[v2] == -1) {
      hs *= PRIME;
    } else
      hs = PRIME * hs + i - last2[v2];
    last1[v] = i;
    if (last2[v2] >= 0) nxt[last2[v2]] = i - last2[v2];
    last2[v2] = prv[i] = i;
    if (first[v] == -1) first[v] = i;
    if (i) ppow[i] = PRIME * ppow[i - 1];
  }
  vector<int> ans;
  for (int i = m; i <= n; i++) {
    int st = i - m;
    if (hs == ht) {
      vector<char> corr(26, 0);
      bool works = true;
      for (int j = 0; j < 26; j++) {
        if (first[j] != -1) {
          int fv = first[j];
          if (corr[t[fv] - 'a'] != 0 && corr[t[fv] - 'a'] != s[st + fv]) {
            works = false;
            break;
          }
          if (corr[s[st + fv] - 'a'] != 0 && corr[s[st + fv] - 'a'] != t[fv]) {
            works = false;
            break;
          }
          corr[t[fv] - 'a'] = s[st + fv];
          corr[s[st + fv] - 'a'] = t[fv];
        }
      }
      if (works) ans.push_back(st + 1);
    }
    if (i >= n) break;
    int rloc = nxt[st];
    if (rloc >= 1 && rloc <= m) hs -= ppow[m - rloc - 1] * rloc;
    hs -= ppow[m] * prv[st];
    int v2 = s[i] - 'a';
    if (last2[v2] <= st) {
      hs *= PRIME;
    } else
      hs = PRIME * hs + i - last2[v2];
    if (last2[v2] >= 0) nxt[last2[v2]] = i - last2[v2];
    last2[v2] = prv[i] = i;
  }
  cout << ans.size() << '\n';
  for (int v : ans) cout << v << " ";
  return 0;
}
