#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
long long n, m, p;
map<long long, long long> mp_b;
map<long long, long long> cur;
vector<long long> ans;
long long a[maxn], b[maxn];
int main() {
  cin >> n >> m >> p;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
  }
  for (long long i = 1; i <= p && i + (m - 1) * p <= n; i++) {
    mp_b.clear();
    for (long long j = 1; j <= m; j++) mp_b[b[j]]++;
    int cnt = 0;
    for (long long j = i;; j += p) {
      if (cnt == m) break;
      mp_b[a[j]]--;
      if (mp_b[a[j]] == 0) mp_b.erase(a[j]);
      cnt++;
    }
    long long l = i, r = l + m * p;
    if (mp_b.size() == 0) {
      ans.push_back(l);
    }
    while (true) {
      if (r > n) break;
      mp_b[a[l]]++, mp_b[a[r]]--;
      if (mp_b[a[l]] == 0) mp_b.erase(a[l]);
      if (mp_b[a[r]] == 0) mp_b.erase(a[r]);
      l += p, r += p;
      if (mp_b.size() == 0) ans.push_back(l);
    }
  }
  cout << ans.size() << endl;
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
