#include <bits/stdc++.h>
using namespace std;
int a[200050];
int b[200050];
int c[200050];
int now[200050];
int tot[200050];
int ans[200050];
int n, m, cnt, p;
int main() {
  int i, j;
  while (scanf("%d %d %d", &n, &m, &p) != EOF) {
    for (i = 0; i < n; i++) scanf("%d", a + i);
    for (i = 0; i < m; i++) scanf("%d", b + i);
    if (1 + (long long)p * (m - 1) > n) {
      printf("0\n");
      continue;
    }
    sort(b, b + m);
    for (i = 0; i < m; i++) c[i] = b[i];
    int sz = unique(c, c + m) - c;
    for (i = 0; i < sz; i++) {
      tot[i] = upper_bound(b, b + m, c[i]) - lower_bound(b, b + m, c[i]);
    }
    cnt = 0;
    for (i = 0; i < p; i++) {
      memset(now, 0, sizeof(now));
      int l, r;
      l = i;
      r = i - p;
      while (r < n) {
        r += p;
        if (r >= n) continue;
        int k = lower_bound(c, c + sz, a[r]) - c;
        if (a[r] != c[k]) {
          while (l != r) {
            int kk = lower_bound(c, c + sz, a[l]) - c;
            now[kk] = 0;
            l += p;
          }
          l += p;
          continue;
        }
        now[k]++;
        if (now[k] > tot[k]) {
          while (now[k] > tot[k]) {
            int kk = lower_bound(c, c + sz, a[l]) - c;
            now[kk]--;
            l += p;
          }
        }
        if ((r - l) / p + 1 == m) {
          ans[cnt++] = l;
          int kk = lower_bound(c, c + sz, a[l]) - c;
          now[kk]--;
          l += p;
        }
      }
    }
    printf("%d\n", cnt);
    if (cnt) {
      sort(ans, ans + cnt);
      printf("%d", ans[0] + 1);
      for (i = 1; i < cnt; i++) printf(" %d", ans[i] + 1);
      printf("\n");
    }
  }
  return 0;
}
