#include <bits/stdc++.h>
using namespace std;
int n, m, p, i, l, r, x, cnt, a[200200];
bool q[200200];
map<int, int> frq;
inline void check(int k) {
  int mismatches = 0;
  map<int, int> mp;
  for (int i = 1, j = k; i <= m; ++i, j += p) {
    auto it = frq.find(a[j]);
    cnt = ++mp[a[j]];
    if (it == frq.end() || cnt > it->second) {
      q[k] = true;
      mismatches++;
    }
  }
  while (k + p <= r) {
    auto it = frq.find(a[k]);
    cnt = --mp[a[k]];
    if (it == frq.end() || cnt >= it->second) {
      mismatches--;
    }
    k += p;
    x = k + (m - 1) * p;
    it = frq.find(a[x]);
    cnt = ++mp[a[x]];
    if (it == frq.end() || cnt > it->second) {
      mismatches++;
    }
    if (mismatches) {
      q[k] = true;
    }
  }
}
int main() {
  cin >> n >> m >> p;
  for (i = 1; i <= n; ++i) scanf("%d", a + i);
  for (i = 1; i <= m; ++i) scanf("%d", &x), ++frq[x];
  if (n <= (m - 1LL) * p) {
    return printf("0"), 0;
  }
  vector<int> ans;
  r = n - (m - 1) * p;
  l = min(r, p);
  for (i = 1; i <= l; ++i) check(i);
  for (i = 1; i <= r; ++i)
    if (!q[i]) ans.push_back(i);
  printf("%d\n", ans.size());
  for (int x : ans) printf("%d ", x);
  return 0;
}
