#include <bits/stdc++.h>
using namespace std;
const int DIM = 2e5 + 5;
vector<pair<int, int>> lst[DIM];
map<int, int> mmp1, mmp2;
vector<int> ans;
void upd(int &cnt, int x, int y) {
  if (mmp1.find(x) != mmp1.end()) cnt -= (mmp1[x] == mmp2[x]);
  mmp2[x] += y;
  if (mmp1.find(x) != mmp1.end()) cnt += (mmp1[x] == mmp2[x]);
  return;
}
int main(void) {
  ios::sync_with_stdio(false);
  int n, m, p;
  cin >> n >> m >> p;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    lst[i % p].push_back(make_pair(x, i + 1));
  }
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    mmp1[x]++;
  }
  for (int k = 0; k < p; k++) {
    int cnt = 0;
    mmp2.clear();
    for (int i = 0, j = 0; j < lst[k].size(); j++) {
      upd(cnt, lst[k][j].first, 1);
      if (j - i == m) upd(cnt, lst[k][i++].first, -1);
      if (cnt == mmp1.size()) ans.push_back(lst[k][i].second);
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int x : ans) cout << x << " ";
  cout << endl;
  return 0;
}
