#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, p;
  cin >> n >> m >> p;
  vector<long long> a(n);
  map<long long, long long> b, x;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < m; i++) {
    long long t;
    cin >> t;
    b[t]++;
  }
  set<long long> ans;
  for (long long i = 0; i < n && (i + 1) + (m - 1) * p <= n && i < p; i++) {
    x = b;
    for (long long j = 0; j < m; j++) {
      long long k = i + j * p;
      if (b.find(a[k]) != b.end()) {
        x[a[k]]--;
        if (!x[a[k]]) x.erase(a[k]);
      }
    }
    if (!(x.size())) ans.insert(i);
    for (long long j = i; j + m * p < n; j += p) {
      long long add = j + m * p;
      if (b.find(a[j]) != b.end()) {
        x[a[j]]++;
        if (!x[a[j]]) x.erase(a[j]);
      }
      if (b.find(a[add]) != b.end()) {
        x[a[add]]--;
        if (!x[a[add]]) x.erase(a[add]);
      }
      if (!(x.size())) ans.insert(j + p);
    }
  }
  cout << ans.size() << "\n";
  for (set<long long>::iterator i = ans.begin(); i != ans.end(); i++)
    cout << *i + 1 << " ";
}
