#include <bits/stdc++.h>
using ll = long long;
const int C = 100001, D = 10;
int gcd(int a, int b) {
  if (b == 0) return a;
  if (a == 0) return b;
  int c = a % b;
  while (b > 0) c = a % b, a = b, b = c;
  return a;
}
int tmp_s[D], tmp_val[D], all_divs[C];
int generate_divs(int divs[], int s[], int ln, int all_divs[]) {
  int cur_val = 1, i, j = 1;
  for (i = 0; i < ln; i++) tmp_val[i] = 1;
  all_divs[0] = 1;
  while (1) {
    for (i = ln - 1; i >= 0 && tmp_s[i] == s[i]; i--)
      cur_val /= tmp_val[i], tmp_val[i] = 1, tmp_s[i] = 0;
    if (i < 0) break;
    tmp_s[i]++;
    tmp_val[i] *= divs[i], cur_val *= divs[i];
    all_divs[j] = cur_val, j++;
  }
  return j;
}
int find_divs(int a, int dv[], int s[]) {
  int ln = 0;
  ll i = 0;
  for (i = 2; i * i <= a; i++) {
    if (a % i == 0) dv[ln] = i, s[ln] = 0, ln++;
    while (a % i == 0) s[ln - 1]++, a /= i;
  }
  if (a > 1) dv[ln] = a, s[ln] = 1, ln++;
  return ln;
}
int divs[D], s[D];
int main() {
  int n, m, r_gcd = 0, a, i, j, ln, all_ln;
  ll res = 0;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%d", &a);
    r_gcd = gcd(r_gcd, a - 1);
  }
  while (r_gcd % 2 == 0) r_gcd /= 2;
  ln = find_divs(r_gcd, divs, s);
  all_ln = generate_divs(divs, s, ln, all_divs);
  for (i = 0; i < all_ln; i++) {
    for (j = all_divs[i]; j < m; j *= 2) res += m - j;
  }
  printf("%lld\n", res);
  return 0;
}
