#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int N, Q;
    cin >> N >> Q;
    int d, p;
    cin >> d >> p;
    if(p == 0) {
        for(int q = 0, h; q < Q; ++q)
        {
            cin >> h;
            if((h + d - 1) / d <= N)
            {
                cout << (h + d - 1) / d << "\n";
            }
            else
            {
                cout << -1 << "\n";
            }
        }
    }
}