#include <bits/stdc++.h>
const int MAXN = 3e5 + 10;
const double eps = 1e-8;
using namespace std;
const int mod1 = 1e9 + 7;
const int mod2 = 1e9 + 9;
struct edge {
  int t, v;
  edge* next;
} e[MAXN << 1], *h[MAXN], *o = e;
void add(int x, int y, int vul) {
  o->t = y;
  o->v = vul;
  o->next = h[x];
  h[x] = o++;
}
int n, m;
long long ksm(long long a, long long b, long long c) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % c;
    a = a * a % c;
    b = b >> 1;
  }
  return ans;
}
char s1[MAXN], s2[MAXN];
long long sum1[26][MAXN], sum2[26][MAXN], ans1[26], ans2[26];
int num[26][MAXN], pos1[26];
void __Hash(char str[]) {
  int len = strlen(str);
  for (int i = 1; i <= len; i++) {
    int t = str[i - 1] - 'a';
    for (int j = 0; j <= 25; j++)
      sum1[j][i] = sum1[j][i - 1], sum2[j][i] = sum2[j][i - 1],
      num[j][i] = num[j][i - 1];
    num[t][i]++;
    sum1[t][i] += ksm(131, i, mod1);
    sum1[t][i] %= mod1;
    sum2[t][i] += ksm(233, i, mod2);
    sum2[t][i] %= mod2;
  }
}
int st[MAXN], tot;
int main() {
  scanf("%d%d", &n, &m);
  scanf("%s", s1);
  scanf("%s", s2);
  __Hash(s1);
  long long d1 = 0, d2 = 0;
  for (int i = 0; i <= m - 1; i++) {
    d1 += ksm(131, i + 1, mod1) * s2[i] % mod1;
    d1 %= mod1;
    d2 += ksm(233, i + 1, mod2) * s2[i] % mod2;
    d2 %= mod2;
  }
  for (int i = 0; i <= n - m; i++) {
    for (int j = 0; j <= 25; j++)
      ans1[j] = (sum1[j][i + m] - sum1[j][i] + mod1) % mod1;
    for (int j = 0; j <= 25; j++)
      ans2[j] = (sum2[j][i + m] - sum2[j][i] + mod2) % mod2, pos1[j] = j;
    int flag = 0;
    for (int j = 0; j <= 25; j++) {
      if (num[j][i + m] - num[j][i] == 0) continue;
      int l = i + 1;
      int r = i + m;
      int pos;
      while (l <= r) {
        int mid = (l + r) >> 1;
        if (num[j][mid] > num[j][i])
          pos = mid, r = mid - 1;
        else
          l = mid + 1;
      }
      if (pos1[s1[pos - 1] - 'a'] == (s2[pos - i - 1] - 'a')) continue;
      if (pos1[s1[pos - 1] - 'a'] != (s1[pos - 1] - 'a')) {
        flag = 1;
        break;
      }
      if (pos1[s2[pos - i - 1] - 'a'] != (s2[pos - i - 1] - 'a')) {
        flag = 1;
        break;
      }
      swap(ans1[s1[pos - 1] - 'a'], ans1[s2[pos - i - 1] - 'a']);
      swap(ans2[s1[pos - 1] - 'a'], ans2[s2[pos - i - 1] - 'a']);
      pos1[s1[pos - 1] - 'a'] = s2[pos - i - 1] - 'a';
      pos1[s2[pos - i - 1] - 'a'] = s1[pos - 1] - 'a';
    }
    if (flag) continue;
    long long tt1 = 0, tt2 = 0;
    for (int j = 0; j <= 25; j++)
      tt1 += 1ll * ('a' + j) * ans1[j] % mod1, tt1 %= mod1,
          tt2 += 1ll * ('a' + j) * ans2[j] % mod2, tt2 %= mod2;
    long long t1 = d1 * ksm(131, i, mod1) % mod1;
    long long t2 = d2 * ksm(233, i, mod2) % mod2;
    if (tt1 == t1 && tt2 == t2) st[++tot] = i + 1;
  }
  printf("%d\n", tot);
  for (int i = 1; i <= tot; i++) printf("%d ", st[i]);
  printf("\n");
  return 0;
}
