#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int a[MAXN];
int st[4 * MAXN];
int MOD;
int mrg(int a, int b) {
  long long mul = 1ll * a * b;
  mul %= MOD;
  return (int)mul;
}
void init(int idx, int left, int right) {
  if (left == right) {
    st[idx] = a[left];
    return;
  }
  init(2 * idx, left, (left + right) / 2);
  init(2 * idx + 1, (left + right) / 2 + 1, right);
  st[idx] = mrg(st[2 * idx], st[2 * idx + 1]);
}
int query(int idx, int left, int right, int l, int r) {
  if (l <= left && right <= r) return st[idx];
  int ret = 1;
  if (r > (left + right) / 2)
    ret = mrg(ret, query(2 * idx + 1, (left + right) / 2 + 1, right, l, r));
  if (l <= (left + right) / 2)
    ret = mrg(ret, query(2 * idx, left, (left + right) / 2, l, r));
  return ret;
}
void dbg(int idx, int left, int right) {
  cout << idx << " " << left << " " << right << " " << st[idx] << endl;
  if (left != right) {
    dbg(idx + idx, left, (left + right) / 2);
    dbg(idx + idx + 1, (left + right) / 2 + 1, right);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  cin >> MOD;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] %= MOD;
  }
  init(1, 1, n);
  long long anss = 0;
  for (int l = 1; l <= n; l++) {
    if (query(1, 1, n, l, n) != 0) continue;
    int lo = l, hi = n - 1, ans = n;
    while (lo <= hi) {
      int md = (lo + hi) / 2;
      if (query(1, 1, n, l, md) == 0) {
        ans = md;
        hi = md - 1;
      } else
        lo = md + 1;
    }
    anss += (n - ans + 1);
  }
  cout << anss << endl;
  return 0;
}
