#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
unordered_map<int, int> mp;
int a[N], b[N];
vector<int> ans;
int n, m, p;
int zero, cnt;
void add(int x, int toadd) {
  if (!mp.count(x)) return;
  if (mp[x] == 0) --zero;
  mp[x] += toadd;
  if (mp[x] == 0) ++zero;
}
int main() {
  scanf("%d%d%d", &n, &m, &p);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d", b + i);
    mp[b[i]]++;
  }
  cnt = mp.size();
  for (int i = 0; i < p && i + (long long)(m - 1) * p < (long long)n; ++i) {
    for (int r = i, l = i - (m - 1) * p; l < n || r < n; r += p, l += p) {
      if (r < n) {
        add(a[r], -1);
      }
      if (r < n && l >= 0) {
        if (zero == cnt) {
          ans.push_back(l);
        }
      }
      if (l >= 0) {
        add(a[l], 1);
      }
    }
  }
  printf("%d\n", ans.size());
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); ++i) {
    printf("%d%c", ans[i] + 1, " \n"[i == ans.size() - 1]);
  }
  return 0;
}
