#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 100, C = 26, base = 987, MOD = 99999199999;
long long val[C], num[C], valT[C], numT[C], p[N];
queue<long long> pos[C];
map<long long, long long> mp;
vector<long long> ans;
bool mark[C];
string s, t;
long long n, m, cnt, hT;
inline long long Hash(string str, long long l, long long r, long long (&val)[C],
                      long long (&num)[C]) {
  memset(mark, 0, sizeof mark);
  memset(num, 0, sizeof num);
  memset(val, 0, sizeof val);
  cnt = 0;
  long long res = 0;
  for (long long i = l; i < r; i++) {
    long long x = str[i] - 'a';
    if (!mark[x]) {
      num[x] = ++cnt;
      mark[x] = true;
    }
    val[x] = (val[x] + p[r - 1 - i]) % MOD;
  }
  for (long long i = 0; i < C; i++)
    res = (res + ((val[i] * num[i]) % MOD)) % MOD;
  return res;
}
inline void update(long long i) {
  long long tmp = s[i - 1] - 'a';
  pos[tmp].pop();
  val[tmp] = (MOD + val[tmp] - p[m - 1]) % MOD;
  for (long long j = 0; j < C; j++)
    if (pos[j].front() < i + m - 1) {
      val[j] = (val[j] * base) % MOD;
    }
  tmp = s[i + m - 1] - 'a';
  val[tmp] = (val[tmp] + p[0]) % MOD;
  tmp = s[i - 1] - 'a';
  num[tmp] = 1;
  long long hlp = 1;
  for (long long j = 0; j < C; j++) {
    if (pos[j].front() < pos[tmp].front()) {
      num[j]--;
      num[tmp]++;
    }
    if (pos[j].front() < i + m - 1) hlp++;
  }
  tmp = s[i + m - 1] - 'a';
  if (pos[tmp].front() == i + m - 1) num[tmp] = hlp;
}
inline bool check(long long i) {
  mp.clear();
  bool ok = true;
  for (long long j = 0; j < C && ok; j++)
    for (long long k = 0; k < C && ok; k++) {
      if (pos[j].front() < i + m && num[j] == numT[k]) {
        if ((mp.find(j) != mp.end() && mp[j] != k) ||
            (mp.find(k) != mp.end() && mp[k] != j)) {
          ok = false;
        }
        mp[j] = k;
        mp[k] = j;
      }
    }
  return ok;
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m >> s >> t;
  p[0] = 1;
  for (long long i = 1; i < N; i++) p[i] = (p[i - 1] * base) % MOD;
  hT = Hash(t, 0, m, valT, numT);
  for (long long i = 0; i < n; i++) {
    long long x = s[i] - 'a';
    pos[x].push(i);
  }
  for (long long i = 0; i < C; i++) pos[i].push(N);
  if (Hash(s, 0, m, val, num) == hT && check(0)) ans.push_back(0);
  for (long long i = 1; i + m <= n; i++) {
    update(i);
    long long res = 0;
    for (long long i = 0; i < C; i++)
      res = (res + ((val[i] * num[i]) % MOD)) % MOD;
    if (res == hT && check(i)) ans.push_back(i);
  }
  cout << (long long)ans.size() << '\n';
  for (auto x : ans) cout << x + 1 << " ";
}
