#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 50;
ifstream fin("in.in");
int ok[N];
int n, m, p;
map<int, int> s, M;
int a[N], b[N];
vector<int> v;
int main() {
  cin >> n >> m >> p;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= m; ++i) {
    cin >> b[i];
    M[b[i]]++;
  }
  for (int q = 1; q <= p && (q + (m - 1) * p) <= n; ++q) {
    int i = q, elem = 0, k = 0, Q;
    while (elem < m && i <= n) {
      elem++;
      map<int, int>::iterator it = M.find(a[i]);
      if (it != M.end()) {
        if (s[a[i]] < (*it).second) k++;
        s[a[i]]++;
      }
      if (elem < m && i <= n) i += p;
    }
    while (i <= n) {
      Q = i - p * (m - 1);
      if (k == m) v.push_back(Q);
      map<int, int>::iterator it = M.find(a[Q]);
      if (it != M.end()) {
        if (s[a[Q]] <= (*it).second) --k;
        s[a[Q]]--;
      }
      i += p;
      if (i <= n) {
        map<int, int>::iterator it = M.find(a[i]);
        if (it != M.end()) {
          if (s[a[i]] < (*it).second) k++;
          s[a[i]]++;
        }
      }
    }
    Q = q;
    while (Q <= n) s[a[Q]] = 0, Q += p;
  }
  sort(v.begin(), v.end());
  cout << v.size() << "\n";
  for (vector<int>::iterator it = v.begin(); it != v.end(); ++it)
    cout << *it << " ";
  return 0;
}
