#include <bits/stdc++.h>
using namespace std;
long long int powmod(long long int a, int b, int n) {
  long long int rm = 1;
  while (b) {
    if (b % 2) {
      rm = (rm * a) % n;
    }
    a = (a * a) % n;
    b /= 2;
  }
  return rm;
}
int a[int(2e5 + 10)], b[int(2e5 + 10)], intHash[int(2e5 + 10)] = {0};
std::map<int, int> Hash;
int main() {
  int n, ans = 0, st, ed, eq, mxl, m, p, love = 0;
  scanf("%d", &n);
  ;
  scanf("%d", &m);
  ;
  scanf("%d", &p);
  ;
  for (int i = int(1); i <= (int)n; i++) scanf("%d", &a[i]);
  ;
  for (int i = int(1); i <= (int)m; i++) {
    scanf("%d", &b[i]);
    ;
    if (!Hash[b[i]]) love++;
    Hash[b[i]]++;
  }
  for (int i = 1; i <= p; ++i) {
    st = ed = i;
    std::map<int, int> map2;
    eq = love;
    for (int j = 1; j < m; ++j) {
      if (map2[a[ed]] == Hash[a[ed]] && Hash[a[ed]]) eq++;
      map2[a[ed]]++;
      if (map2[a[ed]] == Hash[a[ed]]) eq--;
      ed += p;
      if (ed > n) break;
    }
    if (ed > n) continue;
    while (1) {
      if (ed > n) break;
      if (Hash[a[ed]] == map2[a[ed]] && Hash[a[ed]]) eq++;
      map2[a[ed]]++;
      if (Hash[a[ed]] == map2[a[ed]]) eq--;
      if (!eq) {
        intHash[st] = 1;
        ans++;
      }
      ed += p;
      if (Hash[a[st]] == map2[a[st]]) eq++;
      map2[a[st]]--;
      if (Hash[a[st]] == map2[a[st]] && Hash[a[st]]) eq--;
      st += p;
    }
  }
  printf("%d\n", ans);
  for (int i = 1; i <= n; ++i)
    if (intHash[i]) printf("%d ", i);
  return 0;
}
