99044 - 鸡国福利

#include<bits/stdc++.h>

using namespace std; 

#define N 1000003

int a[N],b[N],n,m; 

int main(){
	freopen("welfare.in","r",stdin); 
	freopen("welfare.out","w",stdout);  
	scanf("%d%d",&n,&m); 
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]); 
	int k=0; 
	for(int i=1;i<=n;i++){
		for(int j=2;j>=1 && a[i]*j>=m ;j--){
			int v=a[i]*j; 
			if (b[k]<=v) b[++k]=v; 
			else {
				int l=1,r=k; 
				while (l<r){
					int mid=(l+r) >> 1; 
					if (b[mid]>v) r=mid;
					else l=mid+1; 
				}
				b[l]=v; 
			}
		}
	}
	cout<<k<<endl; 
	return 0; 
}