#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:268435456")
using namespace std;
long long p;
int n, m, rc;
int a[200100];
int b[200100];
int res[200100];
map<int, int> z;
int t[400100];
int cnt;
int main() {
  cin >> n >> m >> p;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  for (int i = 0; i < m; i++) {
    if (z.find(b[i]) == z.end()) z[b[i]] = cnt++;
    b[i] = z[b[i]];
  }
  for (int i = 0; i < n; i++) a[i] = z.find(a[i]) == z.end() ? cnt : z[a[i]];
  for (int i = 0; i < p && i + (m - 1) * p < n; i++) {
    for (int j = 0; j < cnt; j++) t[j] = 0;
    for (int j = 0; j < m; j++) t[b[j]]--;
    for (int j = 0; j < m; j++) t[a[i + j * p]]++;
    int nz = 0;
    for (int j = 0; j < cnt; j++) nz += t[j] == 0;
    if (nz == cnt) res[rc++] = i;
    for (int j = i + m * p; j < n; j += p) {
      t[a[j]]++;
      if (a[j] != cnt) {
        if (t[a[j]] == 0) nz++;
        if (t[a[j]] == 1) nz--;
      }
      t[a[j - m * p]]--;
      if (a[j - m * p] != cnt) {
        if (t[a[j - m * p]] == 0) nz++;
        if (t[a[j - m * p]] == -1) nz--;
      }
      if (nz == cnt) res[rc++] = j - (m - 1) * p;
    }
  }
  sort(res, res + rc);
  cout << rc << endl;
  for (int i = 0; i < rc; i++) cout << res[i] + 1 << " ";
  return 0;
}
