#include <bits/stdc++.h>
using namespace std;
const int maxn = 500300;
const int INF = 1e9 + 9;
const int alph = 128;
int n, m;
char s[maxn], t[maxn];
int z[maxn];
int prv[maxn], nxt[maxn], op[maxn];
int last[alph], fp[alph], link[alph];
int main() {
  scanf("%d %d\n", &n, &m);
  scanf("%s\n%s", s, t);
  for (int i = int(0); i <= int(alph - 1); ++i) last[i] = -1, fp[i] = -1;
  for (int i = int(0); i <= int(n + m); ++i) {
    if (i == m) {
      for (int i = int(0); i <= int(alph - 1); ++i) last[i] = -1;
      continue;
    }
    char c = (i < m ? t[i] : s[i - m - 1]);
    prv[i] = (last[c] < 0 ? -1 : i - last[c]);
    if (last[c] >= 0) nxt[last[c]] = i;
    last[c] = i;
    if (i < m) fp[c] = i;
  }
  for (int i = int(0); i <= int(n + m); ++i) op[i] = prv[i];
  for (int i = int(0); i <= int(n); ++i) t[i + 1 + m] = s[i];
  vector<int> res;
  int l = 0, r = 0;
  prv[nxt[0]] = -1;
  for (int i = int(1); i <= int(n + m); ++i) {
    if (i == m) continue;
    if (i <= r) z[i] = min(z[i - l], r - i + 1);
    while (z[i] < m && i + z[i] <= n + m && op[z[i]] == prv[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
    prv[nxt[i]] = -1;
    if (z[i] == m) {
      bool valid = 1;
      for (int j = int(0); j <= int(alph - 1); ++j) link[j] = -1;
      for (int j = int(0); j <= int(alph - 1); ++j) {
        if (fp[j] < 0) continue;
        char og = t[fp[j]], cur = t[i + fp[j]];
        if (link[og] == -1 && link[cur] == -1)
          link[og] = cur, link[cur] = og;
        else if (link[og] != cur || link[cur] != og)
          valid = 0;
      }
      for (int j = int(0); j <= int(alph - 1); ++j)
        if (link[j] > 0) valid &= (j == link[link[j]]);
      if (valid) res.push_back(i - m);
    }
  }
  printf("%d\n", res.size());
  for (auto x : res) printf("%d ", x);
  return 0;
}
