#include <bits/stdc++.h>
using namespace std;
bool yes(map<int, int>& wb, map<int, int>& w, const vector<int>& b) {
  for (int i = 0; i < b.size(); i++) {
    if (wb[b[i]] != w[b[i]]) {
      return false;
    }
  }
  return true;
}
int main() {
  long long n, m, p;
  cin >> n >> m >> p;
  vector<int> a(n), b(m);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  map<int, int> wb;
  for (int i = 0; i < m; i++) {
    wb[b[i]]++;
  }
  vector<int> ans;
  for (int q = 0; q < min(n, p); q++) {
    map<int, int> w;
    int c = 0;
    if (q + (m - 1) * p >= n) continue;
    for (int i = q; i <= q + (m - 1) * p; i += p) {
      w[a[i]]++;
    }
    set<int> bad;
    for (int i = 0; i < b.size(); i++) {
      if (w[b[i]] != wb[b[i]]) {
        bad.insert(b[i]);
      }
    }
    if (bad.empty()) {
      ans.push_back(q);
    }
    for (int i = q; i + m * p < n; i += p) {
      w[a[i]]--;
      w[a[i + m * p]]++;
      if (w[a[i]] != wb[a[i]] && wb[a[i]] != 0) {
        bad.insert(a[i]);
      } else {
        bad.erase(a[i]);
      }
      if (w[a[i + m * p]] != wb[a[i + m * p]] && wb[a[i + m * p]] != 0) {
        bad.insert(a[i + m * p]);
      } else {
        bad.erase(a[i + m * p]);
      }
      if (bad.empty()) {
        ans.push_back(i + p);
      }
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] + 1 << " ";
  }
}
