#include <bits/stdc++.h>
using namespace std;
int n, m, p, a[200005];
map<int, int> b, mp;
bool vis[200005];
vector<int> ans;
int main() {
  int i, j;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &p);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= m; i++) {
    scanf("%d", &j);
    b[j]++;
  }
  int tot = b.size();
  for (i = 1; i <= n; i++) {
    while (i <= n && vis[i]) i++;
    if (i + (m - 1) * (long long)p > (long long)n) break;
    mp.clear();
    int x = 0, cnt = 0, lst = i;
    for (j = i; x < m; j += p) {
      vis[j] = true;
      x++;
      mp[a[j]]++;
      if (mp[a[j]] == b[a[j]])
        cnt++;
      else if (mp[a[j]] == b[a[j]] + 1)
        cnt--;
    }
    if (cnt == tot) ans.push_back(i);
    while (j <= n) {
      vis[j] = true;
      mp[a[lst]]--;
      if (mp[a[lst]] == b[a[lst]])
        cnt++;
      else if (mp[a[lst]] == b[a[lst]] - 1)
        cnt--;
      lst += p;
      mp[a[j]]++;
      if (mp[a[j]] == b[a[j]])
        cnt++;
      else if (mp[a[j]] == b[a[j]] + 1)
        cnt--;
      if (cnt == tot) ans.push_back(lst);
      j += p;
    }
  }
  printf("%d\n", ans.size());
  sort(ans.begin(), ans.end());
  for (auto xx : ans) printf("%d ", xx);
  return 0;
}
