#include <bits/stdc++.h>
using namespace std;
vector<int> res;
map<int, int> base, tmp;
int a[500005];
int main() {
  int n, m, p, b;
  scanf("%d%d%d", &n, &m, &p);
  int bnd = n - (m - 1) * p;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &b);
    base[b]++;
  }
  for (int i = 1; i <= p; i++) {
    tmp.clear();
    int num = 0, r = 0;
    for (int j = i; j <= n; j += p) {
      num++;
      tmp[a[j]]++;
      if (tmp[a[j]] <= base[a[j]]) r++;
      if (num > m) {
        int k = a[j - m * p];
        if (tmp[k] <= base[k]) r--;
        tmp[k]--;
        num--;
      }
      if (r == m) res.push_back(j - (m - 1) * p);
    }
  }
  int size = res.size();
  sort(res.begin(), res.end());
  printf("%d\n", size);
  for (int i = 0; i < size; i++) printf("%d ", res[i]);
  printf("\n");
  return 0;
}
