#include <bits/stdc++.h>
using namespace std;
int a[200100], b[200100];
bool cmp(map<int, int>& A, map<int, int>& B);
int main() {
  int n, m, p;
  while (cin >> n >> m >> p) {
    map<int, int> ma;
    vector<int> sol;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < m; i++) {
      cin >> b[i];
      ma[b[i]]++;
    }
    for (int i = 0; i < p; i++) {
      map<int, int> t;
      int k = 1;
      for (int j = i; j < n; j += p, k++) {
        if (k > m) {
          t[a[j]]++;
          t[a[j - p * m]]--;
          if (t[a[j - p * m]] == 0) t.erase(a[j - p * m]);
          if (cmp(t, ma)) sol.push_back(j - p * m + p);
        } else if (k == m) {
          t[a[j]]++;
          if (cmp(t, ma)) sol.push_back(j - p * m + p);
        } else {
          t[a[j]]++;
        }
      }
    }
    cout << sol.size() << endl;
    sort(sol.begin(), sol.end());
    for (int i = 0; i < sol.size(); i++) {
      if (i > 0) cout << ' ';
      cout << sol[i] + 1;
    }
    cout << endl;
  }
  return 0;
}
bool cmp(map<int, int>& A, map<int, int>& B) {
  bool y = true;
  for (map<int, int>::iterator i = A.begin(); i != A.end(); i++) {
    if (B.count(i->first) > 0) {
      if (i->second != B[i->first]) {
        y = false;
        break;
      }
    } else {
      y = false;
      break;
    }
  }
  return y;
}
