#include <bits/stdc++.h>
using namespace std;
const int N = 1<<19;
const int LOG = 23;
int n,a[N],k,g[N][LOG];
int gcd(int a, int b) {
int r;
while(b) r=a%b,a=b,b=r;
return a;
}
void preprocess() {
int i,j;
for(i=1;i<=n;i++) g[i][0]=a[i];
for(j=1;(1<<j)<=n;j++) for(i=1;i+(1<<j)-1<=n;i++) g[i][j]=gcd(g[i][j-1],g[i+(1<<(j-1))][j-1]);
}
int query(int a, int b) {
int k=log2(b-a+1);
return gcd(g[a][k],g[b-(1<<k)+1][k]);
}
bool check(int length) {
int i;
for(i=1;i+length-1<=n;i++) if(query(i,i+length-1)>=k) return true;
return false;
}
int main() {
int i,left,right,middle;
scanf("%d %d", &n, &k);
for(i=1;i<=n;i++) {
scanf("%d", &a[i]);
}
preprocess();
left=0;
right=n+1;
while(right-left>1) {
middle=(left+right)>>1;
if(check(middle)) left=middle;
else right=middle;
}
printf("%d\n", left);
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE4gPSAxPDwxOTsKY29uc3QgaW50IExPRyA9IDIzOwoKaW50IG4sYVtOXSxrLGdbTl1bTE9HXTsKCmludCBnY2QoaW50IGEsIGludCBiKSB7CglpbnQgcjsKCXdoaWxlKGIpIHI9YSViLGE9YixiPXI7CglyZXR1cm4gYTsKfQoKdm9pZCBwcmVwcm9jZXNzKCkgewoJaW50IGksajsKCWZvcihpPTE7aTw9bjtpKyspIGdbaV1bMF09YVtpXTsKCWZvcihqPTE7KDE8PGopPD1uO2orKykgZm9yKGk9MTtpKygxPDxqKS0xPD1uO2krKykgZ1tpXVtqXT1nY2QoZ1tpXVtqLTFdLGdbaSsoMTw8KGotMSkpXVtqLTFdKTsKfQoKaW50IHF1ZXJ5KGludCBhLCBpbnQgYikgewoJaW50IGs9bG9nMihiLWErMSk7CglyZXR1cm4gZ2NkKGdbYV1ba10sZ1tiLSgxPDxrKSsxXVtrXSk7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