#include <bits/stdc++.h>
using namespace std;
const int oo = 999999999;
const double PI = 3.1415931;
const double eps = 1e-9;
const int maxN = 2 * 100000 + 10;
int a[maxN];
int n, m, p;
map<int, int> b, s;
map<int, queue<int> > armory;
bool flag[maxN];
vector<int> ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> p;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= m; i++) {
    int x;
    cin >> x;
    b[x]++;
  }
  for (int l = 1; l <= p; l++) {
    s.clear();
    armory.clear();
    int sum = m;
    queue<int> q;
    for (int i = l; i <= n; i += p) {
      if (b[a[i]] > s[a[i]]) {
        s[a[i]]++;
        sum--;
        flag[i] = true;
      } else {
        armory[a[i]].push(i);
      }
      q.push(i);
      if ((int)q.size() >= m) {
        int level = q.front();
        q.pop();
        if (sum == 0) ans.push_back(level);
        if (flag[level] == true) {
          while (!armory[a[level]].empty() &&
                 armory[a[level]].front() <= level) {
            armory[a[level]].pop();
          }
          if (armory[a[level]].size() > 0) {
            int pnt = armory[a[level]].front();
            armory[a[level]].pop();
            flag[pnt] = true;
          } else {
            s[a[level]]--;
            sum++;
          }
        } else {
          while (!armory[a[level]].empty() && armory[a[level]].front() <= level)
            armory[a[level]].pop();
        }
      }
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < (int)ans.size(); i++) cout << ans[i] << " ";
  return 0;
}
