/*
Copyright 2012 Marek "p2004a" Rusinowski
Naive pattern matching algorithm
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define MAXN 1000000
int tab[MAXN], n, m;
char str[MAXN], pat[MAXN];
void search(const char *str, const char *pat, int str_len, int pat_len, bool (*callback)(int idx, void *data), void *data = NULL) {
for (int j, i = 0; i <= str_len - pat_len; ++i) {
for (j = 0; j < pat_len; ++j) {
if (str[i + j] != pat[j]) {
break;
}
}
if (j == pat_len && !callback(i, data)) {
break;
}
}
}
bool func(int a, void *) {
printf("%d\n", a);
return true;
}
int main() {
scanf("%d%d%s%s", &n, &m, str, pat);
search(str, pat, n, m, func);
return 0;
}
LyoKICBDb3B5cmlnaHQgMjAxMiBNYXJlayAicDIwMDRhIiBSdXNpbm93c2tpCiAgTmFpdmUgcGF0dGVybiBtYXRjaGluZyBhbGdvcml0aG0KKi8gCiNpbmNsdWRlIDxjc3RkaW8+CiNpbmNsdWRlIDxjc3RkbGliPgojaW5jbHVkZSA8Y3N0cmluZz4KCiNkZWZpbmUgTUFYTiAxMDAwMDAwCgppbnQgdGFiW01BWE5dLCBuLCBtOwpjaGFyIHN0cltNQVhOXSwgcGF0W01BWE5dOwoKdm9pZCBzZWFyY2goY29uc3QgY2hhciAqc3RyLCBjb25zdCBjaGFyICpwYXQsIGludCBzdHJfbGVuLCBpbnQgcGF0X2xlbiwgYm9vbCAoKmNhbGxiYWNrKShpbnQgaWR4LCB2b2lkICpkYXRhKSwgdm9pZCAqZGF0YSA9IE5VTEwpIHsKICBmb3IgKGludCBqLCBpID0gMDsgaSA8PSBzdHJfbGVuIC0gcGF0X2xlbjsgKytpKSB7CiAgICBmb3IgKGogPSAwOyBqIDwgcGF0X2xlbjsgKytqKSB7CiAgICAgIGlmIChzdHJbaSArIGpdICE9IHBhdFtqXSkgewogICAgICAgIGJyZWFrOwogICAgICB9CiAgICB9CiAgICBpZiAoaiA9PSBwYXRfbGVuICYmICFjYWxsYmFjayhpLCBkYXRhKSkgewogICAgICBicmVhazsKICAgIH0KICB9Cn0KCmJvb2wgZnVuYyhpbnQgYSwgdm9pZCAqKSB7CiAgcHJpbnRmKCIlZFxuIiwgYSk7CiAgcmV0dXJuIHRydWU7Cn0KCmludCBtYWluKCkgewogIHNjYW5mKCIlZCVkJXMlcyIsICZuLCAmbSwgc3RyLCBwYXQpOwogIHNlYXJjaChzdHIsIHBhdCwgbiwgbSwgZnVuYyk7CiAgcmV0dXJuIDA7Cn0K