#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m, p, cc = 0;
  cin >> n >> m >> p;
  unordered_map<int, int> ma;
  int ar[n], br[m];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> br[i];
    ma[br[i]]++;
  }
  cc = ma.size();
  vector<int> ans;
  for (int i = 0; i < p; i++) {
    unordered_map<int, int> mm;
    int la = i, cc = 0, req = m;
    for (int ind = i; ind < n; ind += p) {
      if (ma.count(ar[ind])) {
        if (ma[ar[ind]] > mm[ar[ind]]) {
          req--;
        }
        mm[ar[ind]]++;
      }
      assert(req >= 0);
      if (req == 0) {
        ans.push_back(la);
      }
      if (++cc >= m && ma.count(ar[la])) {
        if (ma[ar[la]] >= mm[ar[la]]) {
          req++;
        }
        assert(mm[ar[la]]);
        mm[ar[la]]--;
      }
      if (cc >= m) {
        la += p;
      }
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << "\n";
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] + 1 << " ";
  }
  cout << "\n";
}
