#include <bits/stdc++.h>
using namespace std;
const int maxn = 2 * (int)1e5;
int n, m, p;
map<int, int> mps, mx[maxn];
vector<int> ans;
int a[maxn], b[maxn];
int sat[maxn];
queue<int> q[maxn];
int main() {
  scanf("%d%d%d", &n, &m, &p);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  int dif = 0;
  for (int i = 0; i < m; i++) {
    int t;
    scanf("%d", &t);
    if (mps[t] == 0) dif++;
    mps[t]++;
  }
  for (int i = 0; i < n; i++) {
    int di = i % p;
    if (q[di].size() >= m) {
      int u = q[di].front();
      q[di].pop();
      if (mx[di][u] == mps[u])
        sat[di]--;
      else if (mx[di][u] == mps[u] + 1)
        sat[di]++;
      mx[di][u]--;
    }
    int u = a[i];
    q[di].push(a[i]);
    if (mx[di][u] == mps[u])
      sat[di]--;
    else if (mx[di][u] == mps[u] - 1)
      sat[di]++;
    mx[di][u]++;
    if (sat[di] == dif) ans.push_back(i - (m - 1) * p);
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    printf("%d%c", ans[i] + 1, i == ans.size() - 1 ? '\n' : ' ');
  }
  return 0;
}
