Language: C++

#include <bits/stdc++.h>
using namespace std;
#define im 2147483647
#define lm 9223372036854775807
#define ll long long
#define vb vector<bool>
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vector<int>>
#define ii pair<int, int>
#define lower_str(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define upper_str(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define debug(index, num) cout << "Case #" << index << ": " << num << endl
#define mx(an, na) an = max(an, na)
#define mn(an, na) an = min(an, na)
#define rep(i, a, b) for (long long i = a; i < b; i++)
#define rep2(i, a, b) for (long long i = a; i <= b; i++)
#define repp(i, a, b) for (long long i = a; i >= b; i--)
#define repp2(i, a, b) for (long long i = a - 1; i >= b; i--)
#define be(x) x.begin(), x.end()
#define rbe(x) x.rbegin(), x.rend()
#define pb push_back   
ll findlcm(vi v, int n) {
    ll ans = v[0];
    for (int i = 1; i < n; i++) 
        ans = (((v[i] * ans)) / 
                ( __gcd(v[i], ans))); 
    return ans;
}
int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, m;
    cin >> n >> m;
    vector<ll> v(n);
    rep(i, 0, n) cin >> v[i];
    ll lcm = findlcm(v, n);
    ll i = 1;
    ll ans = 0;
    while(lcm * i <= m) {
        ans++;
        i += 2;
    }
    cout << ans;
    return 0;
}   


// typedef long long int ll; 
// int gcd(int a, int b) 
// { 
//     if (b == 0) 
//         return a; 
//     return gcd(b, a % b); 
// } 
  
// ll findlcm(int arr[], int n) 
// { 
//     // Initialize result 
//     ll ans = arr[0]; 
  
//     // ans contains LCM of arr[0], ..arr[i] 
//     // after i'th iteration, 
//     for (int i = 1; i < n; i++) 
//         ans = (((arr[i] * ans)) / 
//                 (gcd(arr[i], ans))); 
  
//     return ans; 
// } 
// int main() 
// { 
//     int arr[] = { 2, 7, 3, 9, 4 }; 
//     int n = sizeof(arr) / sizeof(arr[0]); 
//     printf("%lld", findlcm(arr, n)); 
//     return 0; 
// } 

Compiler output:
a.cc: In function 'long long int findlcm(std::vector<int>, int)':
a.cc:27:24: error: no matching function for call to '__gcd(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, long long int&)'
   27 |                 ( __gcd(v[i], ans)));
      |                   ~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:27:24: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('int' and 'long long int')
   27 |                 ( __gcd(v[i], ans)));
      |                   ~~~~~^~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:38:22: error: could not convert 'v' from 'vector<long long int>' to 'vector<int>'
   38 |     ll lcm = findlcm(v, n);
      |                      ^
      |                      |
      |                      vector<long long int>