#include <bits/stdc++.h>
using namespace std;
const int SIZE = 3e5 + 100;
vector<multiset<int>> s;
vector<multiset<int>> cur;
int main() {
  int n, m, p, cnt = 0;
  vector<int> a, b, ans;
  cin >> n >> m >> p;
  if ((long long)p * (m - 1) > n) {
    cout << 0;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    a.push_back(t);
  }
  multiset<int> tmp, tmp2;
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    b.push_back(t);
    tmp.insert(t);
  }
  for (int i = 0; i < p; i++) {
    s.push_back(tmp);
    cur.push_back(tmp2);
  }
  for (int i = 0; i < n; i++) {
    int t = i % p;
    if (i >= p * m) {
      if (cur[t].find(a[i - p * m]) != cur[t].end())
        cur[t].erase(cur[t].find(a[i - p * m]));
      else
        s[t].insert(a[i - p * m]);
    }
    if (s[t].find(a[i]) != s[t].end())
      s[t].erase(s[t].find(a[i]));
    else
      cur[t].insert(a[i]);
    if (s[t].empty() && cur[t].empty()) {
      cnt++;
      ans.push_back(i - p * (m - 1));
    }
  }
  cout << cnt << endl;
  for (int i = 0; i < cnt; i++) printf("%d ", ans[i] + 1);
}
