#include <bits/stdc++.h>
int ans[200111];
int a[200111], b[200111], n, m, p;
int flag[200111];
std::map<int, int> map, hash;
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", b + i);
    map[b[i]]++;
  }
  int na = 0;
  for (int i = 1; i <= p; ++i) {
    hash.clear();
    int k = 0, s = i;
    for (int j = i; j <= n; j += p) {
      ++k;
      hash[a[j]]++;
      if (k >= m) {
        if (hash == map) ans[na++] = s;
        hash[a[s]]--;
        if (hash[a[s]] == 0) hash.erase(a[s]);
        flag[s] = 1;
        s += p;
      }
    }
  }
  printf("%d\n", na);
  std::sort(ans, ans + na);
  for (int i = 0; i < na; ++i) printf(i != na - 1 ? "%d " : "%d\n", ans[i]);
  return 0;
}
