#include <bits/stdc++.h>
using namespace std;
const int INF = 1000 * 1000 * 1000;
const int XD = 2 * 100000 + 5;
int a[XD];
void insert(map<int, int> &m, int val) {
  if (!m.insert(make_pair(val, 1)).second) {
    ++m[val];
  }
}
void erase(map<int, int> &m, int val) { --m[val]; }
int main() {
  int N, M, P;
  scanf("%d%d%d", &N, &M, &P);
  for (int i = 0; i < N; ++i) {
    scanf("%d", a + i);
  }
  map<int, int> bCnt;
  for (int i = 0; i < M; ++i) {
    int x;
    scanf("%d", &x);
    insert(bCnt, x);
  }
  vector<int> answer;
  for (int sp = 0; sp < min(N, P); ++sp) {
    map<int, int> cnt;
    int tot = 0;
    int c = 0;
    for (int i = sp; i < N; i += P) {
      ++tot;
      insert(cnt, a[i]);
      if (bCnt.find(a[i]) != bCnt.end()) {
        if (cnt[a[i]] == bCnt[a[i]]) {
          ++c;
        }
        if (cnt[a[i]] == bCnt[a[i]] + 1) {
          --c;
        }
      }
      if (tot > M) {
        int last = i - M * P;
        erase(cnt, a[last]);
        if (bCnt.find(a[last]) != bCnt.end()) {
          if (cnt[a[last]] == bCnt[a[last]]) {
            ++c;
          }
          if (cnt[a[last]] == bCnt[a[last]] - 1) {
            --c;
          }
        }
      }
      if (c == (int)bCnt.size()) {
        answer.push_back(i - M * P + P + 1);
      }
    }
  }
  printf("%d\n", (int)answer.size());
  sort(answer.begin(), answer.end());
  for (auto el : answer) {
    printf("%d ", el);
  }
  return 0;
}
