#include <bits/stdc++.h>
using namespace std;
vector<int> arr, brr, ans;
map<int, int> mapp, bans;
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  arr.push_back(0);
  for (int i = 0; i < n; i++) {
    int temp;
    scanf("%d", &temp);
    arr.push_back(temp);
  }
  for (int i = 0; i < m; i++) {
    int temp;
    scanf("%d", &temp);
    brr.push_back(temp);
  }
  for (int i = 0; i < m; i++) bans[brr[i]]++;
  if ((m - 1) * q + 1 > n) {
    printf("0\n");
    return 0;
  };
  for (int i = 1; i <= q; i++) {
    mapp.clear();
    deque<int> p;
    for (int j = i; j <= n; j += q) {
      mapp[arr[j]]++;
      p.push_back(j);
      if (p.size() > m) {
        int u = p.front();
        mapp[arr[u]]--;
        p.pop_front();
        if (mapp[arr[u]] == 0) mapp.erase(arr[u]);
      }
      if (mapp == bans) ans.push_back(p.front());
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    if (i == 0)
      printf("%d", ans[i]);
    else
      printf(" %d", ans[i]);
  }
  return 0;
}
