#include <bits/stdc++.h>
using namespace std;
const int maxn = 300000;
const long long mod = 1000000007, hval = 137;
long long a[maxn], b[maxn];
vector<long long> v[maxn];
vector<int> sol;
long long modpow(long long a, long long b) {
  long long x = 1ll, y = a;
  while (b) {
    if (b % 2) x = (x * y) % mod;
    y = (y * y) % mod;
    b /= 2;
  }
  return x;
}
int main() {
  int n, i, j, p, m;
  long long hash_req, cur, cur_hash;
  scanf("%d%d%d", &n, &m, &p);
  for (i = 0; i < n; i++) {
    scanf("%I64d", &a[i]);
    v[(i % p)].push_back(a[i]);
  }
  hash_req = 0;
  for (i = 0; i < m; i++) {
    scanf("%I64d", &b[i]);
    cur = modpow(hval, b[i]);
    hash_req = (hash_req + cur) % mod;
  }
  sol.clear();
  for (i = 0; i < p; i++) {
    if (v[i].size() < m) continue;
    cur_hash = 0;
    for (j = 0; j < m; j++) {
      cur = modpow(hval, v[i][j]);
      cur_hash = (cur_hash + cur) % mod;
    }
    if (cur_hash == hash_req) sol.push_back(i);
    for (j = 0; (j + m) < v[i].size(); j++) {
      cur = modpow(hval, v[i][j]);
      cur_hash = (cur_hash - cur + mod) % mod;
      cur = modpow(hval, v[i][j + m]);
      cur_hash = (cur_hash + cur) % mod;
      if (cur_hash == hash_req) {
        sol.push_back(i + (j + 1) * p);
      }
    }
  }
  printf("%d\n", sol.size());
  sort(sol.begin(), sol.end());
  for (i = 0; i < sol.size(); i++) printf("%d ", sol[i] + 1);
  printf("\n");
  return 0;
}
