#include <bits/stdc++.h>
using namespace std;
const int N = int(2e5) + 50;
int A[N], B[N], n, m, p, diffcnt;
map<int, int> fB, fA;
vector<int> res;
inline int equal(int index) {
  if (fB.count(index) ^ fA.count(index)) return false;
  if (!fB.count(index)) return true;
  return fA[index] == fB[index];
}
int main() {
  scanf("%d%d%d", &n, &m, &p);
  for (int i = 1; i <= n; ++i) scanf("%d", A + i);
  for (int i = 1; i <= m; ++i) {
    scanf("%d", B + i);
    fB[B[i]]++;
  }
  for (int i = 1; i <= p; ++i) {
    fA.clear();
    diffcnt = fB.size();
    for (int j = i; j <= n; j += p) {
      int cnt = (j - i) / p + 1;
      if (cnt > m) {
        int pv = A[j - p * m];
        diffcnt += equal(pv);
        if (!--fA[pv]) fA.erase(pv);
        diffcnt -= equal(pv);
      }
      int nv = A[j];
      diffcnt += equal(nv);
      ++fA[nv];
      diffcnt -= equal(nv);
      if (diffcnt == 0) res.push_back(j - p * (m - 1));
    }
  }
  printf("%d\n", (int)res.size());
  sort(res.begin(), res.end());
  for (int i = 0; i < (int)res.size(); ++i)
    printf("%d%c", res[i], " \n"[i + 1 == (int)res.size()]);
  return 0;
}
