#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
vector<int> a, b, ans;
unsigned long long h1[N], h2[N], st[N];
vector<int> parse_string(string s) {
  int timer = N;
  vector<int> last(200, -1), res;
  for (int i = 0; i < s.length(); i++) {
    res.push_back(last[s[i]] == -1 ? timer++ : i - last[s[i]]);
    last[s[i]] = i;
  }
  return res;
}
char is_equal(int l1, int r1, int l2, int r2) {
  unsigned long long x = h1[r1] - (l1 ? h1[l1 - 1] : 0);
  unsigned long long y = h2[r2] - (l2 ? h2[l2 - 1] : 0);
  if (l1 <= l2) {
    x *= st[l2 - l1];
  }
  if (l2 <= l1) {
    y *= st[l1 - l2];
  }
  return x == y;
}
char naive(int l1, int r1, int l2, int r2) {
  for (int i = 0; i <= r1 - l1; i++)
    if (a[l1 + i] != b[l2 + i]) {
      return false;
    }
  return true;
}
int main() {
  st[0] = 1;
  for (int i = 1; i < N; i++) {
    st[i] = st[i - 1] * 400031;
  }
  int n, m;
  scanf("%d%d\n", &n, &m);
  string s, t;
  getline(cin, s);
  getline(cin, t);
  a = parse_string(s);
  b = parse_string(t);
  for (int i = 0; i < n; i++) {
    h1[i] = (unsigned long long)a[i] * st[i];
    if (i) {
      h1[i] += h1[i - 1];
    }
  }
  for (int i = 0; i < m; i++) {
    h2[i] = (unsigned long long)b[i] * st[i];
    if (i) {
      h2[i] += h2[i - 1];
    }
  }
  for (int start = n - 1, fin = start + m - 1; start >= 0; start--, fin--) {
    static vector<int> last(200, 1e9);
    last[s[start]] = start;
    vector<int> dif = {start - 1};
    if (fin >= n) {
      continue;
    }
    for (int i = 'a'; i <= 'z'; i++)
      if (last[i] <= fin) {
        dif.push_back(last[i]);
      }
    dif.push_back(fin + 1);
    sort(dif.begin(), dif.end());
    char ok = true;
    for (int i = 1; i < dif.size(); i++) {
      int x = dif[i - 1] + 1, y = dif[i] - 1;
      if (x <= y && !is_equal(x, y, x - start, y - start)) {
        ok = false;
      }
    }
    vector<int> mt(200, -1);
    dif.erase(dif.begin());
    dif.pop_back();
    for (int i : dif) {
      int x = s[i], y = t[i - start];
      if (mt[x] == -1) {
        mt[x] = y;
      }
      if (mt[y] == -1) {
        mt[y] = x;
      }
      if (mt[x] != y || mt[y] != x) {
        ok = false;
      }
    }
    if (ok) {
      ans.push_back(start);
    }
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  for (int i : ans) {
    printf("%d ", i + 1);
  }
  return 0;
}
