#include <bits/stdc++.h>
using namespace std;
int a[200000];
int b[200000];
int c[200001];
int t[200001];
vector<int> x;
vector<int> ans;
int add(int r, int cr, int d) {
  if (c[r] == t[r]) cr--;
  t[r] += d;
  if (c[r] == t[r]) cr++;
  return cr;
}
int main() {
  int n, m, p, i, j;
  scanf("%d %d %d", &n, &m, &p);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = 0; i < m; i++) {
    scanf("%d", &b[i]);
    x.push_back(b[i]);
  }
  x.push_back(1000000001);
  sort(x.begin(), x.end());
  x.erase(unique(x.begin(), x.end()), x.end());
  int k = x.size();
  for (i = 0; i < n; i++) {
    int pos = lower_bound(x.begin(), x.end(), a[i]) - x.begin();
    if (a[i] == x[pos])
      a[i] = pos;
    else
      a[i] = k - 1;
  }
  for (i = 0; i < k; i++) {
    c[i] = 0;
    t[i] = 0;
  }
  for (i = 0; i < m; i++) {
    int pos = lower_bound(x.begin(), x.end(), b[i]) - x.begin();
    c[pos]++;
  }
  int cr = 1;
  long long d = (long long)p * (m - 1);
  for (i = 0; i < p; i++) {
    if (i + d >= n) continue;
    for (j = 0; j < m; j++) cr = add(a[i + p * j], cr, 1);
    if (cr == k) ans.push_back(i);
    j = i + p * m;
    while (j < n) {
      cr = add(a[j], cr, 1);
      cr = add(a[j - p * m], cr, -1);
      if (cr == k) ans.push_back(j - p * (m - 1));
      j += p;
    }
    int l = j - p;
    for (j = 0; j < m; j++) cr = add(a[l - p * j], cr, -1);
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  for (i = 0; i < ans.size(); i++) printf("%d ", ans[i] + 1);
  puts("");
  return 0;
}
