#include <bits/stdc++.h>
using namespace std;
string S, T;
int n, m;
int nxt[200005][30];
unsigned long long hashS[200005][30], hashT[200005][30], bpw[200005];
unsigned long long ht;
int base = 10007;
int f[30];
vector<int> ans;
bool chk(int p) {
  memset(f, 0, sizeof(f));
  int ps, pt;
  unsigned long long hps, hpt, temp = 0;
  for (int j = 1; j <= 26; j++) {
    if (nxt[p][j] > p + m - 1) continue;
    ps = j;
    pt = T[(nxt[p][j] - p) + 1] - 'a' + 1;
    if (f[ps] == pt)
      continue;
    else if (f[ps] && f[ps] != pt)
      return 0;
    else {
      f[ps] = pt;
      f[pt] = ps;
      hps = hashS[p + m - 1][ps] - bpw[m] * hashS[p - 1][ps];
      hpt = hashT[m][pt];
      if (hps != hpt ||
          hashS[p + m - 1][pt] - bpw[m] * hashS[p - 1][pt] != hashT[m][ps]) {
        return 0;
      }
      temp += hps * pt;
      if (ps != pt) temp += ps * hashT[m][ps];
    }
  }
  return temp == ht;
}
int main() {
  scanf("%d%d", &n, &m);
  cin >> S >> T;
  S = "%" + S;
  T = "%" + T;
  for (int i = 1; i <= m; i++) {
    ht = ht * base + T[i] - 'a' + 1;
  }
  for (int i = 1; i <= 26; i++) {
    nxt[n + 1][i] = n + 1;
  }
  for (int i = n; i >= 1; i--) {
    for (int j = 1; j <= 26; j++) {
      if (S[i] == 'a' + j - 1)
        nxt[i][j] = i;
      else
        nxt[i][j] = nxt[i + 1][j];
    }
  }
  bpw[0] = 1;
  for (int i = 1; i <= n; i++) {
    bpw[i] = bpw[i - 1] * base;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 26; j++) {
      hashS[i][j] = hashS[i - 1][j] * base + (S[i] == ('a' + j - 1) ? 1 : 0);
    }
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= 26; j++) {
      hashT[i][j] = hashT[i - 1][j] * base + (T[i] == ('a' + j - 1) ? 1 : 0);
    }
  }
  for (int i = 1; i <= n - m + 1; i++) {
    if (chk(i)) ans.push_back(i);
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
