#include <bits/stdc++.h>
using namespace std;
int sa[200010];
int sb[200010];
int ans[200010], pans;
int main() {
  int n, m, p;
  scanf("%d%d%d", &n, &m, &p);
  for (int i = 0; i != n; i++) scanf("%d", sa + i);
  map<int, int> key;
  long long ksum = 0LL;
  int kxor = 0;
  for (int i = 0; i != m; i++) {
    scanf("%d", sb + i);
    key[sb[i]]++;
    ksum += sb[i];
    kxor ^= sb[i];
  }
  for (int i = 0; i != p; i++) {
    if (i + (long long)(m - 1) * p >= (long long)n) continue;
    map<int, int> M;
    long long nowsum = 0LL;
    int nxor = 0;
    for (int j = i; j <= i + (m - 1) * p; j += p) {
      M[sa[j]]++;
      nowsum += sa[j];
      nxor ^= sa[j];
    }
    int s = i, t = i + (m - 1) * p;
    bool last = false;
    while (true) {
      if (last && s - p == t) {
        ans[pans++] = s;
        s += p;
        t += p;
        if (t >= n) break;
        continue;
      }
      if (M == key) {
        ans[pans++] = s;
        last = true;
      } else
        last = false;
      M[sa[s]]--;
      nowsum -= sa[s];
      nxor ^= sa[s];
      if (!M[sa[s]]) M.erase(sa[s]);
      s += p;
      t += p;
      if (t >= n) break;
      M[sa[t]]++;
      nowsum += sa[t];
      nxor ^= sa[t];
    }
  }
  sort(ans, ans + pans);
  printf("%d\n", pans);
  for (int i = 0; i != pans; i++) printf("%d ", ans[i] + 1);
  puts("");
  return 0;
}
