What is wrong with this code?? PLease help!!

// C++ program to find LCM of n elements

#include <bits/stdc++.h>

using namespace std;

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)

{

ll ans = arr[0];

for (int i = 1; i < n; i++)

ans = (((arr[i] * ans)) /

(gcd(arr[i], ans)));

```
return ans;
```

}

int main()

{

int t;

cin>>t;

while(t–)

{

int n,m;

cin>>n>>m;

int a[100000];

for(int i=0;i<n;i++)

cin>>a[i];

long long int d=findlcm(a, n);int flag=0,ctr;

for(int i=m;i>=1;i–)

{

if(d%i!=0)

{

if(flag<(d*i))
{
flag=d*i;

ctr=i;

}else if(flag==(d*i))

{

if(i<ctr)

ctr=i;

}

}

}

if(flag==0)

cout<<1<<endl;

else

cout<<ctr<<endl;

}

return 0;

}