#include <bits/stdc++.h>
using namespace std;
const int N = 200 * 1000 + 10, B = 31, MOD = 1000 * 1000 * 1000 + 9;
int n, m, cnt[B], cnt2[B], cont[N][B], Inv[N], res[B];
string s, t;
vector<int> ans;
int add(int a, int b) { return (a += b) + MOD * (a < 0) - MOD * (a >= MOD); }
int mul(int a, int b) { return 1ll * a * b % MOD; }
int Pow(int a, int b) {
  return (b ? mul((b & 1 ? a : 1), Pow(mul(a, a), b >> 1)) : 1);
}
int inv(int x) {
  if (Inv[x]) return Inv[x];
  return Inv[x] = Pow(Pow(B, x), MOD - 2);
}
bool hsh_range(int s, int e) {
  if (!s)
    for (int i = 0; i < B; i++) res[i] = cont[e][i];
  else
    for (int i = 0; i < B; i++)
      res[i] = mul(add(cont[e][i], -cont[s - 1][i]), inv(s));
  vector<pair<int, int>> num[2];
  map<pair<int, int>, int> mp;
  for (int i = 0; i < B; i++)
    if (res[i] && cnt2[i] && cnt2[i] ^ res[i])
      num[0].push_back({res[i], i}), num[1].push_back({cnt2[i], i});
  int sz = (int)num[0].size();
  if (sz & 1) return 0;
  for (int i = 0; i < 2; i++) sort(num[i].begin(), num[i].end());
  for (int i = 0; i < sz; i++) {
    if (num[0][i].first ^ num[1][i].first) return 0;
    if (num[0][i].second > num[1][i].second)
      swap(num[0][i].second, num[1][i].second);
    mp[{num[0][i].second, num[1][i].second}]++;
  }
  for (auto [x, y] : mp)
    if (y ^ 2) return 0;
  sort(res, res + B);
  for (int i = 0; i < B; i++)
    if (res[i] ^ cnt[i]) return 0;
  return 1;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  cin >> n >> m >> s >> t;
  for (int i = 0; i < m; i++)
    cnt2[t[i] - 'a'] = cnt[t[i] - 'a'] = add(cnt[t[i] - 'a'], Pow(B, i));
  sort(cnt, cnt + B);
  cont[0][s[0] - 'a'] = 1;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < B; j++) cont[i][j] = cont[i - 1][j];
    cont[i][s[i] - 'a'] = add(cont[i][s[i] - 'a'], Pow(B, i));
  }
  for (int i = 0; i + m - 1 < n; i++)
    if (hsh_range(i, i + m - 1)) ans.push_back(i + 1);
  cout << ans.size() << '\n';
  for (int x : ans) cout << x << ' ';
  cout << '\n';
}
