#include <bits/stdc++.h>
using namespace std;
class C_ {};
template <typename T>
C_& operator<<(C_& __m, const T& __s) {
  if (!1) cerr << "\E[91m" << __s << "\E[0m";
  return __m;
}
C_ merr;
struct __s {
  __s() {
    if (1) {
      ios_base::Init i;
      cin.sync_with_stdio(0);
      cin.tie(0);
    }
  }
  ~__s() {
    merr << "Execution time: " << fixed << setprecision(3)
         << (double)clock() / CLOCKS_PER_SEC << " s.\n";
  }
} __S;
long long n, m, p;
long long A[222222];
long long B[222222];
vector<long long> P[222222];
vector<long long> PP[222222];
vector<long long> PX[222222];
vector<long long> PM[222222];
const long long MOD = 1000000009;
long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; }
long long gcdex(long long a, long long b, long long& x, long long& y) {
  long long xx, yy;
  if (a == 0) {
    x = 0, y = 1;
    return b;
  }
  long long g = gcdex(b % a, a, xx, yy);
  x = yy - (b / a) * xx;
  y = xx;
  return g;
}
long long inverse(long long x, long long mod) {
  long long a, _;
  gcdex(x, mod, a, _);
  return (a % MOD + 2 * MOD) % MOD;
}
int main(void) {
  long long ppp = 0, ppx = 0, ppm = 1;
  vector<long long> R;
  cin >> n >> m >> p;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    P[i % p].push_back(A[i]);
  }
  for (int i = 0; i < m; i++) {
    cin >> B[i];
    ppp += B[i];
    ppx ^= B[i];
    ppm = (ppm * B[i]) % MOD;
  }
  for (int i = 0; i < p; i++) {
    for (int j = 0; j < (int)P[i].size(); j++) {
      long long pp = 0, px = 0, pm = 1;
      if (j)
        pp += PP[i][j - 1], px ^= PX[i][j - 1], pm = (pm * PM[i][j - 1]) % MOD;
      PP[i].push_back(pp + P[i][j]);
      PX[i].push_back(px ^ P[i][j]);
      PM[i].push_back((pm * P[i][j]) % MOD);
    }
  }
  for (int q = 0; q <= n - (m - 1) * p; q++) {
    long long l = q / p, r = l + m - 1;
    if ((int)PP[q % p].size() <= r) continue;
    if ((int)PP[q % p].size() <= l - 1) continue;
    long long sp = PP[q % p][r], sx = PX[q % p][r], sm = PM[q % p][r];
    if (l) {
      sp -= PP[q % p][l - 1], sx ^= PX[q % p][l - 1],
          sm = (sm * inverse(PM[q % p][l - 1], MOD)) % MOD;
    }
    if (sp == ppp && sx == ppx && sm == ppm) {
      R.push_back(q);
    }
  }
  cout << R.size() << '\n';
  for (int i = 0; i < (int)R.size(); i++) {
    cout << R[i] + 1 << " ";
  }
  cout << '\n';
  return 0;
}
