#include <bits/stdc++.h>
using namespace std;
const int MAXN = 6e5 + 5;
int a[MAXN], b[MAXN];
vector<int> v;
int main() {
  int m, n, i, j, k, p, l, r;
  map<int, int> aa;
  scanf("%d%d%d", &m, &n, &p);
  for (i = 1; i <= m; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) scanf("%d", &b[i]), aa[b[i]]++;
  for (i = 1; i <= p; i++) {
    int tmp = 0;
    map<int, int> mp;
    for (j = 0; j < n; j++) {
      if (i + j * p > m) {
        goto daze;
      }
      if (mp[a[i + j * p]] < aa[a[i + j * p]] && aa[a[i + j * p]] != 0) tmp++;
      mp[a[i + j * p]]++;
    }
    l = i, r = (n - 1) * p + l;
    while (r <= m) {
      if (tmp == n) v.push_back(l);
      if (mp[a[l]] <= aa[a[l]] && aa[a[l]]) tmp--;
      mp[a[l]]--;
      l += p;
      r += p;
      if (mp[a[r]] < aa[a[r]]) tmp++;
      mp[a[r]]++;
    }
  daze:;
  }
  sort((v).begin(), (v).end());
  printf("%d\n", v.size());
  for (i = 0; i < v.size(); i++) printf("%d ", v[i]);
  puts("");
}
