#include <bits/stdc++.h>
using namespace std;
long long n, m, p;
int a[300000], b[300000];
map<int, int> m1;
vector<int> ans;
int main() {
  cin >> n >> m >> p;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
    m1[b[i]]++;
  }
  for (int it = 0; it < p; it++) {
    map<int, int> M;
    if (it + (m - 1) * p >= n) {
      continue;
    }
    int t = 0;
    for (int j = it; j <= it + (m - 1) * p; j += p) {
      if (M[a[j]] < m1[a[j]]) {
        t++;
      }
      M[a[j]]++;
    }
    if (t == m) {
      ans.push_back(it);
    }
    for (int j = it + m * p; j < n; j += p) {
      int u = j - (m * p);
      if (M[a[u]] <= m1[a[u]]) {
        t--;
      }
      M[a[u]]--;
      if (M[a[j]] < m1[a[j]]) {
        t++;
      }
      M[a[j]]++;
      if (t == m) {
        ans.push_back(u + p);
      }
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] + 1 << " ";
  }
  return 0;
}
