#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
int n, m, a[maxn], mm, ans, res[maxn];
map<int, int> mp;
int x, tot = 1, l, r;
inline void write() {
  cout << ans << endl;
  for (int i = 1; i < tot; i++) cout << res[i] << (i == tot - 1 ? '\n' : ' ');
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> mm;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) cin >> x, mp[x]++;
  ans = 0;
  for (int i = 1; i <= mm; i++) {
    map<int, int> mp2;
    l = r = i;
    for (int j = i; j <= n; j += mm) {
      int id = i + (l - i) * mm;
      if (r - l < m) r++, mp2[a[j]]++;
      if (r - l == m) {
        if (mp2 == mp) res[tot++] = id, ans++;
        if (--mp2[a[id]] == 0) mp2.erase(a[id]);
        l++;
      }
    }
  }
  sort(res + 1, res + tot);
  write();
  return 0;
}
