#include <bits/stdc++.h>
using namespace std;
const int MAX = 2 * 1001 * 100;
int a[MAX], b[MAX];
int n, m, p, ans = 0;
vector<int> out;
map<int, int> cnt;
void check(int r) {
  map<int, int> mp;
  int rp = n % p, ted = n / p;
  if (r < rp) ted++;
  if (ted < m) return;
  for (int i = r; i <= (m - 1) * p + r; i += p) {
    mp[a[i]]++;
  }
  set<int> s;
  for (map<int, int>::iterator it = cnt.begin(); it != cnt.end(); it++) {
    int q = it->first, w = it->second;
    mp[q] -= w;
    if (mp[q] == 0) s.insert(q);
  }
  if (s.size() == mp.size()) {
    ans++;
    out.push_back(r);
  }
  for (int i = (m)*p + r; i < n; i += p) {
    mp[a[i]]++;
    if (mp[a[i]] == 0)
      s.insert(a[i]);
    else
      s.erase(a[i]);
    mp[a[i - (m)*p]]--;
    if (mp[a[i - (m)*p]] == 0)
      s.insert(a[i - (m)*p]);
    else
      s.erase(a[i - (m)*p]);
    if (s.size() == mp.size()) {
      ans++;
      out.push_back(i - (m - 1) * p);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> p;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int j = 0; j < m; j++) {
    cin >> b[j];
    cnt[b[j]]++;
  }
  for (int i = 0; i < p; i++) {
    check(i);
  }
  cout << ans << '\n';
  int t = out.size();
  sort(out.begin(), out.end());
  for (int i = 0; i < t; i++) cout << out[i] + 1 << " ";
}
