#include <bits/stdc++.h>
using namespace std;
unordered_map<int, int> mapper;
int arr[200010];
int main(void) {
  int n, m, p;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &p);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  for (int i = 0; i < m; i++) {
    int x;
    scanf("%d", &x);
    mapper[x]++;
  }
  if (n < m) {
    printf("0");
    return 0;
  }
  int tot = 0;
  vector<int> ret;
  for (int i = 0; i < p; i++) {
    unordered_map<int, int> dup = mapper;
    unordered_set<int> sisa;
    bool valid = true;
    if ((1LL * i + 1LL * (m - 1) * p) >= (long long)n || i >= n) break;
    for (int j = 0; j < m; j++) {
      int data = arr[i + j * p];
      dup[data]--;
    }
    for (unordered_map<int, int>::iterator it = dup.begin(); it != dup.end();
         it++) {
      if (it->second != 0) sisa.insert(it->first);
    }
    int first = i;
    int last = i + (m - 1) * p;
    while (last < n) {
      if (sisa.empty()) {
        tot++;
        ret.push_back(first);
      }
      last += p;
      if (last >= n) break;
      dup[arr[first]]++;
      if (dup[arr[first]] == 0)
        sisa.erase(arr[first]);
      else
        sisa.insert(arr[first]);
      dup[arr[last]]--;
      if (dup[arr[last]] == 0)
        sisa.erase(arr[last]);
      else
        sisa.insert(arr[last]);
      first += p;
    }
  }
  printf("%d\n", tot);
  sort(ret.begin(), ret.end());
  for (int i = 0; i < ret.size(); i++) printf("%d ", ret[i] + 1);
  return 0;
}
