#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int n, m, p;
int a[200004], b[200004];
int sol[200004];
int ns = 0;
int main() {
  scanf("%d%d%d", &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]);
  int num = m;
  for (int i = 1; i <= p && i + (m - 1) * 1ll * p <= n; ++i) {
    mp.clear();
    num = m;
    for (int j = 1; j <= m; ++j) mp[b[j]]++;
    for (int j = i, cc = 0; j <= n; j += p) {
      ++cc;
      mp[a[j]]--;
      if (mp[a[j]] == 0) mp.erase(a[j]);
      if (mp.empty()) sol[ns++] = j - (m - 1) * p;
      if (cc == m) {
        --cc;
        int x = a[j - cc * p];
        mp[x]++;
        if (mp[x] == 0) mp.erase(x);
      }
    }
  }
  sort(sol, sol + ns);
  cout << ns << endl;
  for (int i = 0; i < ns; ++i) printf("%d ", sol[i]);
}
