#include <bits/stdc++.h>
using namespace std;
map<long long, bool> mp;
map<long long, bool> vis;
map<long long, int> idx;
int main() {
  int a, q, k, m;
  scanf("%d%d%d%d", &a, &q, &k, &m);
  for (int x, i = 0; i < m; ++i) {
    scanf("%d", &x);
    mp[x] = true;
  }
  long long cur = a;
  int ans = 0;
  vector<long long> tmp;
  while (abs(cur) <= k) {
    if (vis[cur]) {
      if (ans == 0)
        puts("0");
      else {
        int index = idx[cur];
        for (int i = index; i < tmp.size(); ++i)
          if (mp.find(tmp[i]) == mp.end()) {
            puts("inf");
            return 0;
          }
        printf("%d\n", ans);
      }
      return 0;
    }
    vis[cur] = true;
    idx[cur] = tmp.size();
    tmp.push_back(cur);
    if (mp.find(cur) == mp.end()) ++ans;
    cur *= q;
  }
  printf("%d\n", ans);
  return 0;
}
