#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n, m, p;
  cin >> n >> m >> p;
  vector<int> a(n), b(m);
  for (ll i = 0; i < n; ++i) cin >> a[i];
  for (ll i = 0; i < m; ++i) cin >> b[i];
  unordered_map<int, int> mb;
  for (int i : b) ++mb[i];
  vector<int> ans;
  for (ll i = 0; i < p; ++i) {
    unordered_map<int, int> ma;
    if (i + (m - 1) * p >= n) break;
    for (ll j = i; j < i + (m - 1) * p; j += p) ++ma[a[j]];
    for (ll j = i + (m - 1) * p; j < n; j += p) {
      ++ma[a[j]];
      bool ok = true;
      for (auto& c : mb) {
        if (ma[c.first] != c.second) {
          ok = false;
          break;
        }
      }
      if (ok) ans.push_back(j - (m - 1) * p);
      --ma[a[j - (m - 1) * p]];
    }
  }
  cout << ans.size() << '\n';
  sort(begin(ans), end(ans));
  for (int i : ans) cout << 1 + i << ' ';
  return 0;
}
