#include <bits/stdc++.h>
using namespace std;
map<int, int> cnt, b;
vector<int> ans;
int a[200010], x;
int n, m, p;
int main() {
  cin >> n >> m >> p;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    cin >> x;
    b[x]++;
  }
  for (int i = 0; i < p; i++) {
    if (i + (long long)(m - 1) * p >= n) break;
    long long j;
    cnt = b;
    for (j = i; j <= i + (long long)(m - 1) * p; j += p)
      if (--cnt[a[j]] == 0) cnt.erase(a[j]);
    if (cnt.size() == 0) ans.push_back(i + 1);
    for (long long k = i; j < n; j += p, k += p) {
      if (--cnt[a[j]] == 0) cnt.erase(a[j]);
      if (++cnt[a[k]] == 0) cnt.erase(a[k]);
      if (cnt.size() == 0) ans.push_back(k + p + 1);
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << ' ';
  return 0;
}
