#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200001;
string s, t;
int n, m;
long long mod[2];
long long hs[2][26];
long long hsum[2][26][MAXN];
long long pw[2];
const long long base = 256;
vector<int> T[26];
long long getHash(int pos, int len, int alpha, int mo) {
  long long mi = 0, pi = 0;
  if (pos != 0) {
    mi = (hsum[mo][alpha][pos - 1] * pw[mo]) % mod[mo];
  }
  pi = hsum[mo][alpha][pos + len - 1];
  return (pi - mi + mod[mo] * 100000) % mod[mo];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> s >> t;
  for (int i = 0; i < t.size(); i++) {
    T[t[i] - 'a'].push_back(i);
  }
  pw[0] = pw[1] = 1;
  mod[0] = 1e9 + 7;
  mod[1] = 1e9 + 9;
  for (int i = 0; i < m; i++) {
    pw[0] *= base;
    pw[0] %= mod[0];
    pw[1] *= base;
    pw[1] %= mod[1];
  }
  map<long long, long long> mst[2];
  for (int k = 0; k < 2; k++) {
    for (int i = 0; i < 26; i++) {
      for (int j = 0; j < m; j++) {
        hs[k][i] *= base;
        if (t[j] - 'a' == i) hs[k][i] += 1;
        hs[k][i] %= mod[k];
      }
      mst[k][i] = hs[k][i];
    }
  }
  for (int k = 0; k < 2; k++) {
    for (int i = 0; i < 26; i++) {
      if (s[0] - 'a' == i) hsum[k][i][0] = 1;
      for (int j = 1; j < n; j++) {
        hsum[k][i][j] = hsum[k][i][j - 1] * base;
        if (s[j] - 'a' == i) hsum[k][i][j] += 1;
        hsum[k][i][j] %= mod[k];
      }
    }
  }
  vector<int> ans;
  for (int i = 0; i + m <= n; i++) {
    map<long long, long long> tmp[2];
    int dir[26];
    memset(dir, -1, sizeof(dir));
    bool can = true;
    for (int j = 0; j < 26; j++) {
      if (dir[j] != -1) continue;
      int first = -1;
      if (T[j].size()) first = T[j].front();
      if (first == -1) continue;
      first += i;
      dir[j] = s[first] - 'a';
      int b = dir[s[first] - 'a'];
      if (b != -1 && b != j) can = false;
      dir[s[first] - 'a'] = j;
    }
    for (int k = 0; k < 2; k++) {
      for (int j = 0; j < 26; j++) {
        tmp[k][j] = getHash(i, m, j, k);
      }
    }
    for (int j = 0; j < 26 && can; j++) {
      int k = dir[j];
      if (mst[0][j] == tmp[0][k] && mst[1][j] == tmp[1][k]) {
        continue;
      } else
        can = false;
    }
    if (can) ans.push_back(i + 1);
  }
  cout << ans.size() << "\n";
  for (auto x : ans) cout << x << ' ';
  return 0;
}
