#include <bits/stdc++.h>
using namespace std;
map<int, int> ma, mb;
vector<int> ans;
int a[301010], b[301010];
int main() {
  int n, m, p;
  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]);
  ans.clear();
  for (int i = 1; i <= p; i++) {
    if (i + (long long)p * (m - 1) > (long long)n) break;
    ma.clear();
    mb.clear();
    for (int j = 1; j <= m; j++) {
      if (ma.find(b[j]) == ma.end()) ma[b[j]] = 0;
      ma[b[j]]++;
    }
    int l = i, r = i;
    for (int j = 0; j < m; j++) {
      if (ma.find(a[r]) == ma.end()) {
        if (mb.find(a[r]) == mb.end()) mb[a[r]] = 0;
        mb[a[r]]++;
      } else {
        ma[a[r]]--;
        if (ma[a[r]] == 0) ma.erase(a[r]);
      }
      r += p;
    }
    r = l + m * p;
    while (l + (m - 1) * p <= n) {
      if (ma.size() == 0) ans.push_back(l);
      if (r > n) break;
      bool ina = ma.find(a[l]) != ma.end();
      bool inb = mb.find(a[l]) != mb.end();
      if (!ina && !inb) ma[a[l]] = 1;
      if (!ina && inb) {
        mb[a[l]]--;
        if (mb[a[l]] == 0) mb.erase(a[l]);
      }
      if (ina && !inb) ma[a[l]]++;
      l += p;
      if (ma.find(a[r]) == ma.end()) {
        if (mb.find(a[r]) == mb.end()) mb[a[r]] = 0;
        mb[a[r]]++;
      } else {
        ma[a[r]]--;
        if (ma[a[r]] == 0) ma.erase(a[r]);
      }
      r += p;
    }
  }
  int len = ans.size();
  sort(ans.begin(), ans.end());
  cout << len << endl;
  for (int i = 0; i < len - 1; i++) printf("%d ", ans[i]);
  if (len)
    printf("%d\n", ans[len - 1]);
  else
    printf("\n");
  return 0;
}
