#include <bits/stdc++.h>
using namespace std;
int arr[200005];
int reqS[200005];
bool mark[200005];
int main(int argc, char const *argv[]) {
  int n, m, p;
  scanf("%d %d", &n, &m);
  scanf("%d", &p);
  for (int i = 0; i < n; i += 1) {
    scanf("%d", &arr[i]);
  }
  map<int, int> seqB;
  for (int i = 0; i < m; i += 1) {
    int a;
    scanf("%d", &a);
    ++seqB[a];
  }
  for (int i = 0; i < n; i += 1) {
    auto it = seqB.find(arr[i]);
    if (it != seqB.end()) {
      reqS[i] = it->second;
      mark[i] = true;
    }
  }
  vector<int> ans;
  for (int i = 0; i < p; i += 1) {
    int l = i;
    int len = 0;
    int curC = 0;
    map<int, int> table;
    for (int pos = i; pos < n; pos += p) {
      if (!mark[pos]) {
        table.clear();
        l = pos + p;
        curC = 0;
        len = 0;
        continue;
      }
      ++len;
      while (len > m) {
        if (l > pos) break;
        int lv = arr[l];
        int &ccl = table[lv];
        if (ccl == reqS[l]) --curC;
        l += p;
        --len;
        --ccl;
      }
      int v = arr[pos];
      int sz = reqS[pos];
      int &cc = table[v];
      ++cc;
      if (cc == sz) ++curC;
      if (len == m && curC == seqB.size()) {
        ans.push_back(l);
      }
    }
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  for (int q : ans) {
    printf("%d ", q + 1);
  }
  printf("\n");
  return 0;
}
