#include <bits/stdc++.h>
using namespace std;
int n, m, p;
int aox[200001];
int box[200001];
map<int, int> k;
map<int, bool> q;
map<int, int> work;
int final[200001];
int final_o;
int o;
int main(int argc, char *argv[]) {
  cin >> n >> m >> p;
  for (int i = 1; i <= n; i++) scanf("%d", &aox[i]);
  for (int i = 1; i <= m; i++) scanf("%d", &box[i]);
  sort(box + 1, box + 1 + m);
  int now = -1;
  int num = 0;
  for (int i = 1; i <= m; i++) {
    if (now != box[i]) {
      now = box[i];
      q[box[i]] = 1;
      o++;
      k[box[i]] = 1;
    } else {
      k[box[i]]++;
    }
  }
  int pig = m * p;
  int cal = o;
  int mid;
  for (int i = 1; i <= p; i++) {
    num = 0;
    now = i;
    cal = o;
    work.clear();
    while (1) {
      if (now > n) break;
      if (num < m) {
        if (q[aox[now]]) {
          num++;
          work[aox[now]]++;
          if (work[aox[now]] == k[aox[now]])
            cal--;
          else if (work[aox[now]] == 1 + k[aox[now]])
            cal++;
          if (num == m) {
            if (cal == 0) {
              final_o++;
              final[final_o] = now - pig + p;
            }
          }
        } else {
          work.clear();
          cal = o;
          num = 0;
        }
      } else {
        if (q[aox[now]]) {
          mid = now - pig;
          if (work[aox[mid]] == k[aox[mid]]) cal++;
          work[aox[mid]]--;
          if (work[aox[mid]] == k[aox[mid]]) cal--;
          work[aox[now]]++;
          if (work[aox[now]] == k[aox[now]])
            cal--;
          else if (work[aox[now]] == k[aox[now]] + 1)
            cal++;
          if (cal == 0) {
            final_o++;
            final[final_o] = now - pig + p;
          }
        } else {
          work.clear();
          cal = o;
          num = 0;
        }
      }
      now = now + p;
    }
  }
  sort(final + 1, final + 1 + final_o);
  cout << final_o << endl;
  for (int i = 1; i <= final_o; i++) {
    cout << final[i] << " ";
  }
  cout << endl;
  return 0;
}
