#include <bits/stdc++.h>
using namespace std;
map<int, int> aa;
int i, j, n, k, l, m, arr[1000000], arr2[1000000], pp, p, t, UkL, UkR, r,
    ans[1000000];
int main() {
  cin >> n >> m >> p;
  for (i = 0; i < n; i++) cin >> arr[i];
  for (j = 0; j < m; j++) {
    cin >> arr2[i];
    if (aa[arr2[i]] == 0) pp++;
    aa[arr2[i]]++;
  }
  for (i = 0; i < p; i++) {
    if (p * (m - 1) + i < n)
      for (j = i; j < n; j += p) {
        aa[arr[j]]--;
        if (aa[arr[j]] == 0) t++;
        if ((j - i) / p + 1 == m) break;
      }
    if (p * (m - 1) + i < n) {
      UkL = i;
      UkR = j;
      while (UkR < n) {
        if (t == pp) {
          r++;
          ans[r - 1] = UkL + 1;
        }
        UkR += p;
        if (UkR < n) {
          aa[arr[UkR]]--;
          if (aa[arr[UkR]] == 0) t++;
        }
        aa[arr[UkL]]++;
        if (aa[arr[UkL]] == 1) t--;
        UkL += p;
      }
      while (UkL < n) {
        aa[arr[UkL]]++;
        UkL += p;
      }
      t = 0;
    }
  }
  cout << r << endl;
  sort(ans, ans + r);
  for (i = 0; i < r; i++) cout << ans[i] << ' ';
}
