#include <bits/stdc++.h>
using namespace std;
const int tmax = (int)1e5 + 100;
vector<pair<int, int> > groups[2 * tmax];
int main() {
  int n, m, p;
  scanf("%d %d %d", &n, &m, &p);
  vector<int> b;
  for (int i = 0; i < n; i++) {
    int va;
    scanf("%d", &va);
    groups[i % p].push_back(make_pair(va, i + 1));
  }
  set<int> ativos;
  map<int, int> cc;
  for (int i = 0; i < m; i++) {
    int va;
    scanf("%d", &va);
    cc[va]++;
  }
  int ans = 0;
  vector<int> poses;
  for (int j = 0; j < p; j++) {
    map<int, int> tot;
    set<int> wrong;
    for (int k = 0; k < groups[j].size(); k++) {
      tot[groups[j][k].first]++;
      if (tot[groups[j][k].first] != cc[groups[j][k].first])
        wrong.insert(groups[j][k].first);
      else {
        if (wrong.find(groups[j][k].first) != wrong.end())
          wrong.erase(groups[j][k].first);
      }
      if (wrong.size() == 0 && k + 1 >= m)
        ans++, poses.push_back(groups[j][k - m + 1].second);
      if (k + 1 >= m) {
        tot[groups[j][k - m + 1].first]--;
        if (tot[groups[j][k - m + 1].first] != cc[groups[j][k - m + 1].first])
          wrong.insert(groups[j][k - m + 1].first);
        else {
          if (wrong.find(groups[j][k - m + 1].first) != wrong.end())
            wrong.erase(groups[j][k - m + 1].first);
        }
      }
    }
  }
  printf("%d\n", ans);
  sort(poses.begin(), poses.end());
  for (int i = 0; i < poses.size(); i++) printf("%d ", poses[i]);
  printf("\n");
  return 0;
}
