#include <bits/stdc++.h>
using namespace std;
int n, m, p;
int a[200010];
int b[200010];
map<int, int> mb, mbaux;
vector<int> answ;
int main(void) {
  cin >> n >> m >> p;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < m; ++i) {
    cin >> b[i];
    mb[b[i]]++;
  }
  if (n < m || m * p > n) {
    cout << "0"
         << "\n";
    return 0;
  }
  for (int i = 0; i < min(p, n); ++i) {
    if (i + (long long)(m - 1) * p > n - 1) break;
    int cont = 0;
    mbaux = mb;
    for (int j = 0; j < m; ++j) {
      int w = i + j * p;
      mbaux[a[w]]--;
      if (mbaux[a[w]] >= 0) {
        cont++;
      }
    }
    if (cont == m) {
      answ.push_back(i + 1);
    }
    int last = i;
    for (int j = i + p * m, k = 0; j < n; j += p, ++k) {
      if (last >= n) break;
      mbaux[a[last]]++;
      if (mbaux[a[last]] > 0) cont--;
      mbaux[a[j]]--;
      if (mbaux[a[j]] >= 0) cont++;
      if (cont == m) answ.push_back(last + p + 1);
      last += p;
    }
  }
  printf("%d\n", answ.size());
  sort(answ.begin(), answ.end());
  for (int i = 0; i < answ.size(); ++i) {
    printf("%d ", answ[i]);
  }
  printf("\n");
  return 0;
}
