#include <bits/stdc++.h>
using namespace std;
int n, m, p, A[200005], x;
map<int, int> mp, tp;
priority_queue<int> pq;
void solve(int a) {
  tp.clear();
  queue<int> q;
  for (int i = a; i <= n; i += p) {
    q.push(i);
    tp[A[i]]++;
    if (q.size() == m) {
      int t = q.front();
      q.pop();
      if (mp == tp) pq.push(-t);
      if (--tp[A[t]] == 0) tp.erase(A[t]);
    }
  }
}
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", &x);
    mp[x]++;
  }
  for (int i = 1; i <= p; i++) {
    solve(i);
  }
  printf("%d\n", pq.size());
  while (!pq.empty()) {
    printf("%d ", -pq.top());
    pq.pop();
  }
  return 0;
}
