#include <bits/stdc++.h>
using namespace std;
long long res = 0;
int n, m;
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
long long calc(int x) { return x < m ? m - x + calc(x << 1) : 0; }
int main() {
  ios::sync_with_stdio(false);
  int x, g = 0;
  cin >> n >> m;
  while (n--) {
    cin >> x;
    g = gcd(g, x - 1);
  }
  while (g % 2 == 0 && g) g >>= 1;
  for (int i = 1; i * i <= g; i += 2) {
    if (g % i == 0) {
      res += calc(i);
      if (g / i != i) res += calc(g / i);
    }
  }
  cout << res << endl;
  return 0;
}
