#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T poww(T b, T p) {
  long long a = 1;
  while (p) {
    if (p & 1) {
      a = (a * b);
    }
    p >>= 1;
    b = (b * b);
  }
  return a;
}
template <class T>
inline T modpoww(T b, T p, T mmod) {
  long long a = 1;
  while (p) {
    if (p & 1) {
      a = (a * b) % mmod;
    }
    p >>= 1;
    b = (b * b) % mmod;
  }
  return a % mmod;
}
template <class T>
inline T gcd(T a, T b) {
  if (b > a) return gcd(b, a);
  return ((b == 0) ? a : gcd(b, a % b));
}
template <class T>
inline void scan(vector<T>& a, int n) {
  T b;
  int i;
  for ((i) = 0; (i) < (n); (i) += 1) {
    cin >> b;
    a.push_back(b);
  }
}
inline void scand(vector<int>& a, int n) {
  int b;
  int i;
  for ((i) = 0; (i) < (n); (i) += 1) {
    scanf("%d", &(b));
    a.push_back(b);
  }
}
inline void scanlld(vector<long long>& a, int n) {
  long long b;
  int i;
  for ((i) = 0; (i) < (n); (i) += 1) {
    scanf("%lld", &(b));
    a.push_back(b);
  }
}
int n, m, p;
vector<int> b, vans;
vector<vector<int> > a(2 * 100010, vector<int>());
map<int, int> mp3;
int main() {
  int i, j, k, l, ans = 0;
  cin >> n >> m >> p;
  for ((i) = 0; (i) < (n); (i) += 1) {
    scanf("%d", &(k));
    a[i % p].push_back(k);
  }
  for ((i) = 0; (i) < (m); (i) += 1) {
    scanf("%d", &(k));
    mp3[k]++;
  }
  for ((i) = 0; (i) < (p); (i) += 1) {
    if (a[i].size() < m) continue;
    int s = 0;
    map<int, int> make_pair, mp2;
    map<int, int>::iterator it;
    make_pair = mp3;
    for ((j) = 0; (j) < (min(m, (int)a[i].size())); (j) += 1) {
      it = make_pair.find(a[i][j]);
      if (it != make_pair.end()) {
        it->second -= 1;
      }
    }
    for (typeof(make_pair.begin()) iit = make_pair.begin();
         iit != make_pair.end(); iit++) {
      if (iit->second > 0) s += iit->second;
    }
    l = i + 1;
    if (!s) {
      ans++;
      vans.push_back(i + 1);
    }
    for (j = m; j < a[i].size(); j++) {
      it = make_pair.find(a[i][j - m]);
      if (it != make_pair.end()) {
        if (it->second >= 0) {
          s++;
        }
        it->second++;
      }
      it = make_pair.find(a[i][j]);
      if (it != make_pair.end()) {
        if (it->second > 0) {
          s--;
        }
        it->second--;
      }
      if (!s) {
        ans++;
        vans.push_back((j - m + 1) * p + l);
      }
    }
  }
  cout << ans << "\n";
  sort((vans).begin(), (vans).end());
  for ((i) = 0; (i) < (vans.size()); (i) += 1) cout << vans[i] << " ";
  cout << "\n";
}
