#include <bits/stdc++.h>
using namespace std;
const int maxint = -1u >> 1;
int n, m, a, b, len;
set<int> used;
bool p[100010];
int w[100];
void Getprime() {
  for (int i = 2; i <= 100000; i++)
    if (!p[i]) {
      p[i] = false;
      for (int j = 2; i * j <= 100000; j++) p[i * j] = true;
    }
}
int gcd(int a, int b) { return (a % b == 0) ? b : gcd(b, a % b); }
int main() {
  Getprime();
  scanf("%d%d", &n, &m);
  scanf("%d", &b);
  b--;
  for (int i = 1; i < n; i++) {
    scanf("%d", &a);
    a--;
    b = gcd(a, b);
  }
  while (b % 2 == 0) b /= 2;
  n = 0;
  for (int i = 2; i <= 100000; i++)
    if (!p[i]) {
      while (b % i == 0) {
        w[n++] = i;
        b /= i;
      }
    }
  if (b != 1) w[n++] = b;
  long long ans = 0, tmp;
  for (int sta = 0; sta < (1 << n); sta++) {
    tmp = 1;
    for (int i = 0; i < n; i++)
      if (sta & (1 << i)) tmp *= w[i];
    if (used.find(tmp) == used.end())
      used.insert(tmp);
    else
      continue;
    do {
      ans += (long long)m - tmp;
      tmp *= 2;
    } while (tmp <= m - 1);
  }
  cout << ans << endl;
  return 0;
}
