#include <bits/stdc++.h>
using namespace std;
int N, M, P;
int A[200000], B[200000];
vector<int> ans;
int main() {
  scanf("%d%d%d", &N, &M, &P);
  for (int(i) = 0; (i) < (N); (i)++) scanf("%d", &A[i]);
  for (int(i) = 0; (i) < (M); (i)++) scanf("%d", &B[i]);
  map<int, int> m;
  for (int(j) = 0; (j) < (M); (j)++) m[B[j]]--;
  for (int(i) = 0; (i) < (P); (i)++) {
    int ptr = i, sz = 0, dptr = i;
    while (ptr < N) {
      if (++m[A[ptr]] == 0) m.erase(A[ptr]);
      sz++;
      if (ptr >= P * (M - 1)) {
        if (sz == M && m.size() == 0) ans.push_back(ptr - P * (M - 1) + 1);
        if (--m[A[dptr]] == 0) m.erase(A[dptr]);
        dptr += P;
        sz--;
      }
      ptr += P;
    }
    while (dptr < N) {
      if (--m[A[dptr]] == 0) m.erase(A[dptr]);
      dptr += P;
    }
  }
  sort((ans).begin(), (ans).end());
  printf("%d\n", ans.size());
  for (int(i) = 0; (i) < (ans.size()); (i)++)
    printf("%d%c", ans[i], i + 1 == ans.size() ? '\n' : ' ');
}
