#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int a[maxn], b[maxn];
map<int, int> M;
map<int, int> M2;
int f[maxn];
int main() {
  int n, m, p;
  scanf("%d%d%d", &n, &m, &p);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d", &b[i]);
    M[b[i]]++;
  }
  int num = 0;
  int co = 0;
  for (int i = 0; i < p; i++) {
    co = 0;
    int j = i;
    M2.clear();
    while (j < n) {
      if (!M[a[j]]) {
        co = 0;
        M2.clear();
      } else if (M[a[j]] && M2[a[j]] < M[a[j]]) {
        co++;
        M2[a[j]]++;
      } else {
        while (a[j - co * p] != a[j]) {
          M2[a[j - co * p]]--;
          co--;
        }
      }
      if (co == m) {
        f[num++] = j - (m - 1) * p;
        co--;
        M2[a[j - (m - 1) * p]]--;
      }
      j += p;
    }
  }
  sort(f, f + num);
  printf("%d\n", num);
  for (int i = 0; i < num; i++) printf("%d ", f[i] + 1);
}
