#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
map<int, int> a, b;
vector<int> vec;
int val[N], n, m, p, q[N];
void solve(int x) {
  int h = 0, t = 0;
  b.clear();
  for (int i = x; i <= n; i += p) {
    q[++t] = val[i];
    b[val[i]]++;
    if (t - h == m) {
      if (a == b) vec.push_back(h * p + x);
      int y = q[++h];
      b[y]--;
      if (!b[y]) b.erase(y);
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &p);
  for (int i = 1; i <= n; ++i) scanf("%d", &val[i]);
  for (int i = 1; i <= m; ++i) {
    int x;
    scanf("%d", &x);
    a[x]++;
  }
  for (int i = 1; i <= p; ++i) solve(i);
  sort(vec.begin(), vec.end());
  printf("%d\n", vec.size());
  for (int i = 0; i < vec.size(); ++i) printf("%d ", vec[i]);
  return 0;
}
