#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int n, m, p;
int ans[maxn], a[maxn], b[maxn];
map<int, int> mp, mq;
int k = 0;
void solve(int x) {
  mq.clear();
  queue<int> Q;
  for (int i = x; i <= n; i += p) {
    Q.push(i);
    mq[a[i]]++;
    if (Q.size() == m) {
      if (mp == mq) {
        ans[k++] = Q.front();
      }
      int zz = Q.front();
      mq[a[zz]]--;
      if (!mq[a[zz]]) {
        mq.erase(a[zz]);
      }
      Q.pop();
    }
  }
  return;
}
int main() {
  scanf("%d%d%d", &n, &m, &p);
  memset(ans, 0, sizeof(ans));
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  mp.clear();
  for (int i = 1; i <= m; i++) {
    scanf("%d", &b[i]);
    mp[b[i]]++;
  }
  for (int i = 1; i <= p; i++) {
    solve(i);
  }
  printf("%d\n", k);
  sort(ans, ans + k);
  for (int i = 0; i < k; i++) {
    printf("%d", ans[i]);
    if (i != k - 1)
      printf(" ");
    else
      printf("\n");
  }
  return 0;
}
