#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
int a[maxn];
unordered_map<int, int> b, c;
unordered_map<int, int>::iterator it, it2;
vector<int> ans;
int main() {
  ios_base::sync_with_stdio(0);
  int n, m, p;
  cin >> n >> m >> p;
  int x;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < m; ++i) {
    cin >> x;
    it = b.find(x);
    if (it == b.end())
      b.insert(make_pair(x, 1));
    else
      ++it->second;
  }
  for (int q = 0; q < p; ++q) {
    int cur = 0;
    c.clear();
    for (int i = q; i < n; i += p) {
      if (1ll * i >= 1ll * m * p) {
        it = b.find(a[i - m * p]);
        if (it != b.end()) {
          it2 = c.find(a[i - m * p]);
          if (it2->second <= it->second) --cur;
          --it2->second;
        }
      }
      it = b.find(a[i]);
      if (it == b.end())
        continue;
      else {
        it2 = c.find(a[i]);
        if (it2 == c.end()) it2 = c.insert(make_pair(a[i], 0)).first;
        if (it2->second < it->second) ++cur;
        ++it2->second;
      }
      if (cur == m) ans.push_back(i - (m - 1) * p + 1);
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << '\n';
  for (int i : ans) cout << i << ' ';
  cout << '\n';
  return 0;
}
