#include <bits/stdc++.h>
using namespace std;
long long b1, q, l, m;
map<long long, int> mark;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  while (cin >> b1 >> q >> l >> m) {
    mark.clear();
    for (int i = 0, a; i < m; i++) {
      cin >> a;
      mark[a] = 1;
    }
    int ans = 0;
    for (int i = 0; i < 100 && abs(b1) <= abs(l); i++, b1 *= q) {
      if (!mark[b1]) ans++;
    }
    if (ans < 50)
      cout << ans << endl;
    else
      cout << "inf" << endl;
  }
  return 0;
}
