#include <bits/stdc++.h>
using namespace std;
const int NMAX = 200010;
int N, M, P, A[NMAX], B[NMAX], Freq[NMAX], FreqB[NMAX];
vector<int> Pos[NMAX], Sol;
map<int, int> Hash;
int main() {
  scanf("%i %i %i", &N, &M, &P);
  for (int i = 1; i <= N; ++i) {
    scanf("%i", &A[i]);
    Hash[A[i]] = 1;
    Pos[i % P].push_back(i);
  }
  for (int i = 1; i <= M; ++i) {
    scanf("%i", &B[i]);
    Hash[B[i]] = 1;
  }
  int Cnt = 0, Last = -1;
  for (map<int, int>::iterator it = Hash.begin(); it != Hash.end(); ++it) {
    if (it->first != Last) Cnt++;
    it->second = Cnt;
    Last = it->first;
  }
  for (int i = 1; i <= N; ++i) A[i] = Hash[A[i]];
  for (int i = 1; i <= M; ++i) {
    B[i] = Hash[B[i]];
    FreqB[B[i]]++;
  }
  sort(B + 1, B + M + 1);
  int CntDistinct = 0, MaxDistinct = 0;
  for (int i = 1; i <= M; ++i)
    if (B[i - 1] != B[i]) CntDistinct++, MaxDistinct++;
  for (int i = 0; i < P; ++i, CntDistinct = MaxDistinct) {
    if (Pos[i].size() < M) continue;
    for (int j = 0; j < Pos[i].size(); ++j) {
      int NowPos = Pos[i][j];
      if (Freq[A[NowPos]] == FreqB[A[NowPos]] && FreqB[A[NowPos]] > 0)
        CntDistinct++;
      Freq[A[NowPos]]++;
      if (Freq[A[NowPos]] == FreqB[A[NowPos]] && FreqB[A[NowPos]] > 0)
        CntDistinct--;
      if (j >= M - 1) {
        if (j >= M) {
          int OutPos = Pos[i][j - M];
          if (Freq[A[OutPos]] == FreqB[A[OutPos]] && FreqB[A[OutPos]] > 0)
            CntDistinct++;
          Freq[A[OutPos]]--;
          if (Freq[A[OutPos]] == FreqB[A[OutPos]] && FreqB[A[OutPos]] > 0)
            CntDistinct--;
        }
        if (CntDistinct == 0) Sol.push_back(Pos[i][j - M + 1]);
      }
    }
    for (int j = 0; j < Pos[i].size(); ++j) Freq[A[Pos[i][j]]] = 0;
  }
  sort(Sol.begin(), Sol.end());
  printf("%i\n", Sol.size());
  for (int i = 0; i < Sol.size(); ++i) printf("%i ", Sol[i]);
}
