#include <bits/stdc++.h>
using namespace std;
map<int, int> m, m2;
vector<int> o;
int main() {
  int n, mo, p, a[300001], b[300001], r = 0, j, cv, k, i, t = 0;
  cin >> n >> mo >> p;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < mo; i++) {
    cin >> b[i];
    if (m[b[i]] == 0) t++;
    m[b[i]]++;
  }
  for (i = 0; i < p; i++) {
    m2.clear();
    r = t;
    cv = 0;
    for (j = i; j < n; j += p) {
      cv++;
      if (m2[a[j]] == m[a[j]]) r++;
      m2[a[j]]++;
      if (m2[a[j]] == m[a[j]]) r--;
      k = j - mo * p;
      if (cv > mo) {
        if (m2[a[k]] == m[a[k]]) r++;
        m2[a[k]]--;
        if (m2[a[k]] == m[a[k]]) r--;
        cv--;
      }
      if (r == 0) o.push_back(j - (mo - 1) * p);
    }
  }
  n = o.size();
  sort(o.begin(), o.end());
  cout << n << endl;
  for (i = 0; i < n; i++) cout << o[i] + 1 << " ";
  cout << endl;
}
