Result: Accepted
Time: 1641ms
Memory: 39200kB
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define inf 0x3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define MAXN 100010
#define ll long long
const ll mod=10092272478850909;
int n,k;
long long a[MAXN];
map<long long,int>dp;
int main()
{
int ans=0;
long long ma=0;
scanf("%d%d",&n,&k);
for(int i=1;i<=n;++i)
{
scanf("%lld",&a[i]);
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=k;j++)
{
if(a[i]%j==0) { dp[a[i]/j]++; ans=max(ans,dp[a[i]/j]); }
}
}
printf("%d\n",ans);
}