#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y;
  scanf("%d %d %d %d\n", &n, &m, &x, &y);
  vector<int> a(n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int b;
  vector<pair<int, int> > p;
  scanf("%d", &b);
  for (int i = 0, j = 0; i < n && j < m;) {
    if (a[i] + y < b)
      i++;
    else {
      if (a[i] - x > b)
        j++;
      else
        p.push_back(make_pair(i++, j++));
      scanf("%d", &b);
    }
  }
  printf("%d\n", p.size());
  for (int i = 0; i < p.size(); i++)
    printf("%d %d\n", p[i].first + 1, p[i].second + 1);
  return 0;
}
