#include <bits/stdc++.h>
using namespace std;
template <class T>
typename T::value_type arr_sum(const T& v, int n) {
  typename T::value_type sum = 0;
  for (int i = (0); i < (n); ++i) sum += v[i];
  return sum;
}
struct Sync_stdio {
  Sync_stdio() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
  }
} _sync_stdio;
int main() {
  int n, m;
  long long p;
  cin >> n >> m >> p;
  map<int, int> mi;
  vector<int> a(n);
  vector<int> b(m);
  vector<int> res;
  for (int i = 0; i < n; ++i) cin >> a[i];
  ;
  for (int i = 0; i < m; ++i) cin >> b[i];
  ;
  for (int j = (0); j < (m); ++j) {
    ++mi[b[j]];
  }
  for (int i = (0); i < (p); ++i) {
    int j;
    for (j = 0; i + j * p < n; ++j) {
      if (i + (j - m) * p >= 0) {
        ++mi[a[i + (j - m) * p]];
        if (mi[a[i + (j - m) * p]] == 0) {
          mi.erase(a[i + (j - m) * p]);
        }
      }
      --mi[a[i + j * p]];
      if (mi[a[i + j * p]] == 0) {
        mi.erase(a[i + j * p]);
      }
      if (mi.size() == 0) {
        res.push_back(i + (j - m + 1) * p);
      }
    }
    for (int k = max(0, j - m); i + k * p < n; ++k) {
      ++mi[a[i + k * p]];
      if (mi[a[i + k * p]] == 0) {
        mi.erase(a[i + k * p]);
      }
    }
  }
  sort(res.begin(), res.end());
  cout << res.size() << endl;
  for (auto i : res) {
    cout << i + 1 << " ";
  }
}
