#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:36777216")
using namespace std;
const long long int inf = 100000000000000000LL;
int curr[30];
vector<int> posS[30];
int currPosS[30];
vector<int> posT[30];
bool check(string& t, string& s, int pos) {
  int p[30];
  memset((p), 255, sizeof(p));
  for (int i = 0; i < 28; i++) {
    if (curr[i] == -1) continue;
    p[i] = s[curr[i] + pos] - 'a' + 1;
  }
  for (int i = 0; i < 28; i++) {
    if (p[i] == -1) continue;
    if (p[p[i]] != i && p[p[i]] != -1) return 0;
  }
  return 1;
}
const int N = 4;
long long int mod[N] = {1000000007LL, 1000000009LL, 1LL << 46, 0};
long long int powers[N] = {31, 31, 31, 101};
long long int hashT[N];
long long int hashS[N];
long long int powersMy[N][3000000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  srand(23);
  int sl, tl;
  cin >> sl >> tl;
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < 30; ++i) {
    curr[i] = -1;
  }
  vector<long long int> tVal(tl, 28), sVal(sl, 28);
  for (int i = 0; i < tl; ++i) {
    char c = t[i];
    int code = c - 'a' + 1;
    if (posT[code].size()) {
      tVal[i] = i - posT[code].back();
    }
    posT[code].push_back(i);
  }
  for (int i = 0; i < sl; ++i) {
    for (int j = 0; j < N; ++j) {
      if (i) {
        powersMy[j][i] = powersMy[j][i - 1] * powers[j];
        if (j != N - 1) powersMy[j][i] %= mod[j];
      } else {
        powersMy[j][0] = 1;
      }
    }
    char c = s[i];
    int code = c - 'a' + 1;
    if (posS[code].size()) {
      sVal[i] = i - posS[code].back();
      if (sVal[i] > tl - 1) {
        sVal[i] = 28;
      }
    }
    posS[code].push_back(i);
  }
  for (int i = 0; i < 30; ++i) {
    if (posT[i].size()) {
      curr[i] = posT[i].front();
    }
  }
  vector<int> ans;
  long long int curpower[N];
  curpower[0] = curpower[1] = 1;
  for (int i = 0; i < tl; ++i) {
    for (int j = 0; j < N; ++j) {
      hashT[j] *= powers[j];
      if (j != N - 1) hashT[j] %= mod[j];
      hashT[j] += tVal[i];
      if (j != N - 1) hashT[j] %= mod[j];
    }
    for (int j = 0; j < N; ++j) {
      hashS[j] *= powers[j];
      if (j != N - 1) hashS[j] %= mod[j];
      hashS[j] += sVal[i];
      if (j != N - 1) hashS[j] %= mod[j];
    }
  }
  for (int i = 0; i < (sl - tl + 1); ++i) {
    if (i) {
      int code = s[i - 1] - 'a' + 1;
      currPosS[code]++;
      int pos = currPosS[code];
      if (posS[code].size() > pos) {
        int nextPos = posS[code][pos];
        int old = sVal[nextPos];
        sVal[nextPos] = 28;
        int d = sVal[nextPos] - old;
        if (nextPos < i + tl - 1) {
          for (int j = 0; j < N; ++j) {
            hashS[j] += d * powersMy[j][tl - 2 - (nextPos - i)];
            if (j != N - 1)
              if (hashS[j] < 0) hashS[j] += mod[j];
            if (j != N - 1) hashS[j] %= mod[j];
          }
        }
      }
    }
    if (i) {
      for (int j = 0; j < N; ++j) {
        if (i) {
          hashS[j] -= powersMy[j][tl - 1] * sVal[i - 1];
          if (j != N - 1) hashS[j] %= mod[j];
          if (j != N - 1)
            if (hashS[j] < 0) hashS[j] += mod[j];
        }
        hashS[j] *= powers[j];
        if (j != N - 1) hashS[j] %= mod[j];
        hashS[j] += sVal[i + tl - 1];
        if (j != N - 1) hashS[j] %= mod[j];
      }
    }
    bool flag = true;
    for (int j = 0; j < N; ++j) {
      long long int val = hashT[j];
      if (j != N - 1) val %= mod[j];
      if (hashS[j] != val) {
        flag = false;
        break;
      }
    }
    if (flag && check(t, s, i)) ans.push_back(i + 1);
  }
  cout << ans.size() << "\n";
  for (int i = 0; i < ans.size(); ++i) {
    cout << ans[i] << " ";
  }
  return 0;
}
