#include <bits/stdc++.h>
using namespace std;
void print(vector<int> &v) {
  int i, sz = ((int)(v).size());
  for (i = 0; i < (sz); i++) cout << v[i] << " ";
  cout << endl;
}
int main() {
  int i, j, k, l, n, m, p;
  cin >> n >> m >> p;
  vector<int> a = vector<int>(n);
  vector<int> b = vector<int>(m);
  for (i = 0; i < (n); i++) cin >> a[i];
  for (i = 0; i < (m); i++) cin >> b[i];
  map<int, int> M;
  for (i = 0; i < (m); i++) M[b[i]]++;
  j = 0;
  vector<int> ans;
  for (k = 0; k < p; k++) {
    l = (n - k);
    if (l < ((long long)m * p - 1)) {
      continue;
    }
    j = 0;
    for (i = k; i < n;) {
      if (M[a[i]]) {
        M[a[i]]--;
        j++;
        i += p;
      } else {
        if (j) {
          M[a[i - j * p]]++;
          j--;
        } else
          i += p;
      }
      if (j == m) {
        ans.push_back(i - j * p + 1);
      }
    }
    ((M).clear());
    for (i = 0; i < (m); i++) M[b[i]]++;
  }
  sort((ans).begin(), (ans).end());
  cout << ((int)(ans).size()) << endl;
  print(ans);
  return 0;
}
