#include <bits/stdc++.h>
using namespace std;
long long n, m, p, a[200020], b[200020], c[200020], o[200020];
void solve() {
  map<int, int> bmp;
  int ans = 0;
  o[0] = 0;
  for (int i = 1; i <= m; i++) bmp[b[i]]++;
  for (int i = 1; i <= p; i++) {
    map<int, int> mp;
    c[0] = 0;
    for (int j = i; j <= n; j += p) c[++c[0]] = a[j];
    if (c[0] < m) continue;
    int q = i;
    for (int j = 1; j <= m; j++) mp[c[j]]++;
    if (bmp == mp) ans++, o[++o[0]] = q;
    for (int j = m + 1; j <= c[0]; j++) {
      q += p;
      int last = c[j - m];
      mp[last]--;
      if (mp[last] == 0) mp.erase(last);
      mp[c[j]]++;
      if (mp == bmp) ++ans, o[++o[0]] = q;
    }
  }
  sort(o + 1, o + 1 + o[0]);
  cout << ans << endl;
  for (int i = 1; i <= o[0]; i++) printf("%d ", o[i]);
  return;
}
int main() {
  cin >> n >> m >> p;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) scanf("%d", &b[i]);
  solve();
  return 0;
}
