**CAN ANYONE TELL ME WHAT IS WRONG WITH MY CODE OR LOGIC??**

it is showing wrong answer

#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;

ll findlcm(int,int,int);

int gcd(int,int);

int gcd(int a,int b)

{

```
if(a==0)
return b;
return gcd(b%a,a);
```

}

ll findlcm(int arr[] ,int n,int m)

{

```
ll ans=arr[0];
for(int i=1;i<n;i++)
ans= (((arr[i]*ans))/(gcd(arr[i],ans)));
ll a;
int res=0;
for(int j=1;j<=m;j++)
{
a= (((j*ans))/(gcd(j,ans)));
if(a>ans)
res=j;
else if(a==ans && res==0)
res=j;
}
return res;
```

}

int main()

{

```
int t;
cin>>t;
if(t< 1 || t>100)
exit(0);
while(t!=0)
{
int n,m;
cin>>n>>m;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
printf("%d\n" , findlcm(arr,n,m));
t--;
}
return 0;
```

}