Result: Accepted
Time: 1470ms
Memory: 39592kB
/*
I have a dream!A AC deram!!
orz orz orz orz orz orz orz orz orz orz orz
orz orz orz orz orz orz orz orz orz orz orz
orz orz orz orz orz orz orz orz orz orz orz
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn = 2e5 + 10;
const ll mod = 10092272478850909;
#define pa pair<int,int>
long long gcd(ll a,ll b){return a == 0? b:gcd(b%a,a);}
inline int read()
{
int x = 0, f = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar())if (ch == '-')f = -1;
for (; isdigit(ch); ch = getchar())x = x * 10 + ch - '0'; return x * f;
}
ull a[150000];
map<ull,int>num;
map<ull,int>::iterator it;
int main()
{
int n,k;
while(scanf("%d %d",&n,&k)!=EOF)
{
for(int i=0;i<n;i++)
{
scanf("%llu",&a[i]);
for(ll j=1;j<=k;j++)
{
if(j>a[i]) break;
if(a[i]%j==0)
num[a[i]/j]++;
}
}
int maxx=0;
for(it=num.begin();it!=num.end();it++)
{
//printf("%llu %d\n",it->first,it->second);
maxx=max(maxx,it->second);
}
printf("%d\n",maxx);
}
return 0;
}
/*
4 3
3 5 6 8
*/