#include <bits/stdc++.h>
using namespace std;
unordered_map<int, int> v, k;
int a[200005];
int b[200005];
bool vis[200005] = {0}, in[200005] = {0};
int main() {
  for (long long i = 0; i < 2e5 + 5; i++) vis[i] = in[i] = 0;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  v.clear();
  long long n, m, p;
  cin >> n >> m >> p;
  long long i;
  for (i = 1; i <= n; i++) cin >> a[i];
  long long d = 0;
  for (i = 1; i <= m; i++) {
    cin >> b[i], v[b[i]]++;
    if (v[b[i]] == 1) d++;
  }
  long long x = n - (m - 1) * p;
  long long j;
  long long z = 0;
  if (x > 0) {
    for (i = 1; i <= x; i++) {
      if (vis[i] == 0) {
        k.clear();
        long long c = 0;
        for (j = i; j <= n; j += p) {
          if (j - (m - 1) * p > 0) vis[j - (m - 1) * p] = 1;
          if (k[a[j]] == v[a[j]]) c--;
          k[a[j]]++;
          if (k[a[j]] == v[a[j]]) c++;
          int y = j - m * p;
          if (y > 0) {
            if (k[a[y]] == v[a[y]]) c--;
            k[a[y]]--;
            if (k[a[y]] == v[a[y]]) c++;
          }
          if (c == d) z++, in[j - (m - 1) * p] = 1;
        }
      }
    }
  }
  cout << z << "\n";
  for (i = 1; i <= n; i++)
    if (in[i]) cout << i << " ";
  cout << endl;
  return 0;
}
