#include <bits/stdc++.h>
using namespace std;
int n, m, p;
int a[200002], b[200002];
map<int, int> chk;
vector<int> ans;
int main() {
  scanf("%d %d %d", &n, &m, &p);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int j = 1; j <= m; j++) {
    scanf("%d", &b[j]);
    if (chk[b[j]] == 0) chk[b[j]] = 1e9;
    chk[b[j]]++;
  }
  for (int i = 1; i <= p; i++) {
    int cnt = m;
    long long lft = 1e16;
    for (int j = i; j <= n; j += p) {
      lft = (long long)j - ((long long)m - 1) * p;
      chk[a[j]]--;
      cnt -= (chk[a[j]] >= 1e9);
      if (lft < 1 || n < lft) continue;
      if (j - i > (m - 1) * p) {
        chk[a[lft - p]]++;
        cnt += (chk[a[lft - p]] > 1e9);
      }
      if (j - lft == (m - 1) * p && cnt == 0) {
        ans.push_back(lft);
      }
    }
    for (; 1 <= lft && lft <= (long long)n; lft += p) {
      chk[a[lft]]++;
    }
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  for (int it : ans) {
    printf("%d ", it);
  }
  return 0;
}
