#include <bits/stdc++.h>
using namespace std;
int a[200100], b[200100];
int main() {
  int n, m, i, j, k, p;
  vector<int> res;
  scanf("%d %d %d", &n, &m, &p);
  for (i = 0; i < n; i++) scanf("%d", a + i);
  for (i = 0; i < m; i++) scanf("%d", b + i);
  for (i = 0; i < p && (long long)(m - 1) * p < n - i; i++) {
    map<int, int> mp;
    for (j = 0; j < m; j++) mp[b[j]]++;
    for (k = i, j = 0; j < m; k += p, j++) {
      mp[a[k]]--;
      if (!mp[a[k]]) mp.erase(a[k]);
    }
    for (j = i;; j += p, k += p) {
      if (!mp.size()) res.push_back(j + 1);
      if (k >= n) break;
      mp[a[k]]--;
      if (mp[a[k]] == 0) mp.erase(a[k]);
      mp[a[j]]++;
      if (mp[a[j]] == 0) mp.erase(a[j]);
    }
  }
  sort(res.begin(), res.end());
  n = res.size();
  cout << n << endl;
  for (i = 0; i < n - 1; i++) {
    printf("%d ", res[i]);
  }
  if (n) printf("%d\n", res[i]);
  return 0;
}
