#include <bits/stdc++.h>
using namespace std;
map<int, int> store;
int A[200008], B[200008];
vector<int> ans;
int main() {
  long long n, m, p;
  cin >> n >> m >> p;
  for (int i = 0; i < n; i++) cin >> A[i];
  for (int i = 0; i < m; i++) {
    cin >> B[i];
  }
  for (int i = 0; i < p; i++) {
    if (i + (p - 1) * m >= n) break;
    store.clear();
    for (long long j = 0; j < m; j++) store[B[j]]++;
    for (long long st = i; st < n; st += p) {
      store[A[st]]--;
      if (store[A[st]] == 0) store.erase(A[st]);
      if (store.size() == 0) ans.push_back(st - p * (m - 1));
      if (st - p * (m - 1) >= 0) {
        int x = st - p * (m - 1);
        store[A[x]]++;
        if (store[A[x]] == 0) store.erase(A[x]);
      }
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) cout << ans[i] + 1 << " ";
  cout << endl;
  return 0;
}
