#include <bits/stdc++.h>
using namespace std;
vector<int> all[200005];
vector<int> ans;
map<int, int> cnt, cntnow;
int main() {
  int n, m, p, tmp;
  scanf("%d %d %d", &n, &m, &p);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &tmp);
    all[i % p].push_back(tmp);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d", &tmp);
    cnt[tmp]++;
  }
  for (int i = 0; i < p; ++i) {
    if (all[i].size() < (unsigned)m) continue;
    bool ok;
    cntnow.clear();
    for (int j = 0; j < m - 1; ++j) cntnow[all[i][j]]++;
    for (unsigned j = m - 1; j < all[i].size(); ++j) {
      ok = true;
      cntnow[all[i][j]]++;
      if (cnt.size() != cntnow.size()) ok = false;
      for (map<int, int>::iterator itr = cnt.begin(), itr2 = cntnow.begin();
           itr != cnt.end() && itr2 != cntnow.end() && ok; ++itr, ++itr2) {
        if (*itr != *itr2) ok = false;
      }
      if (ok) ans.push_back(p * (j - m + 1) + i + 1);
      map<int, int>::iterator itr = cntnow.find(all[i][j - (m - 1)]);
      if ((--itr->second) == 0) cntnow.erase(itr);
    }
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  if (ans.size() > 0) printf("%d", ans[0]);
  for (unsigned i = 1; i < ans.size(); ++i) printf(" %d", ans[i]);
  putchar('\n');
}
