#include "bits/stdc++.h"
using namespace std;
const int N = 5e5 + 5;
int n , k;
int arr[N];
int pre[N];
int suf[N];
int gcd(int a , int b){
while(b){
int temp = a % b;
a = b;
b = temp;
}
return a;
}
bool check(int val){
for(int i = 1 ; i <= n ; i += val){
int l = i;
int r = min(n , i + val - 1);
pre[l] = arr[l];
for(int j = l + 1 ; j <= r ; ++j){
pre[j] = gcd(pre[j - 1] , arr[j]);
}
suf[r] = arr[r];
for(int j = r - 1 ; j >= l ; --j){
suf[j] = gcd(suf[j + 1] , arr[j]);
}
}
for(int i = 1 ; i + val - 1 <= n ; ++i){
if(gcd(suf[i] , pre[i + val - 1]) >= k){
return 1;
}
}
return 0;
}
int solve(){
int l = 1;
int r = n + 1;
while(l < r){
int mid = l + r >> 1;
if(check(mid)){
l = mid + 1;
}
else{
r = mid;
}
}
return l - 1;
}
int main(){
scanf("%d %d" , &n , &k);
for(int i = 1 ; i <= n ; ++i){
scanf("%d" , arr + i);
}
printf("%d\n" , solve());
}
I2luY2x1ZGUgImJpdHMvc3RkYysrLmgiCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmNvbnN0IGludCBOID0gNWU1ICsgNTsKaW50IG4gLCBrOwppbnQgYXJyW05dOwppbnQgcHJlW05dOwppbnQgc3VmW05dOwppbnQgZ2NkKGludCBhICwgaW50IGIpewogICAgd2hpbGUoYil7CiAgICAgICAgaW50IHRlbXAgPSBhICUgYjsKICAgICAgICBhID0gYjsKICAgICAgICBiID0gdGVtcDsKICAgIH0KICAgIHJldHVybiBhOwp9CmJvb2wgY2hlY2soaW50IHZhbCl7CiAgICBmb3IoaW50IGkgPSAxIDsgaSA8PSBuIDsgaSArPSB2YWwpewogICAgICAgIGludCBsID0gaTsKICAgICAgICBpbnQgciA9IG1pbihuICwgaSArIHZhbCAtIDEpOwogICAgICAgIHByZVtsXSA9IGFycltsXTsKICAgICAgICBmb3IoaW50IGogPSBsICsgMSA7IGogPD0gciA7ICsrail7CiAgICAgICAgICAgIHByZVtqXSA9IGdjZChwcmVbaiAtIDFdICwgYXJyW2pdKTsKICAgICAgICB9CiAgICAgICAgc3VmW3JdID0gYXJyW3JdOwogICAgICAgIGZvcihpbnQgaiA9IHIgLSAxIDsgaiA+PSBsIDsgLS1qKXsKICAgICAgICAgICAgc3VmW2pdID0gZ2NkKHN1ZltqICsgMV0gLCBhcnJbal0pOwogICAgICAgIH0KICAgIH0KICAgIGZvcihpbnQgaSA9IDEgOyBpICsgdmFsIC0gMSA8PSBuIDsgKytpKXsKICAgICAgICBpZihnY2Qoc3VmW2ldICwgcHJlW2kgKyB2YWwgLSAxXSkgPj0gayl7CiAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgIH0KICAgIH0KICAgIHJldHVybiAwOwp9CmludCBzb2x2ZSgpewogICAgaW50IGwgPSAxOwogICAgaW50IHIgPSBuICsgMTsKICAgIHdoaWxlKGwgPCByKXsKICAgICAgICBpbnQgbWlkID0gbCArIHIgPj4gMTsKICAgICAgICBpZihjaGVjayhtaWQpKXsKICAgICAgICAgICAgbCA9IG1pZCArIDE7CiAgICAgICAgfQogICAgICAgIGVsc2V7CiAgICAgICAgICAgIHIgPSBtaWQ7CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIGwgLSAxOwp9CmludCBtYWluKCl7CiAgICBzY2FuZigiJWQgJWQiICwgJm4gLCAmayk7CiAgICBmb3IoaW50IGkgPSAxIDsgaSA8PSBuIDsgKytpKXsKICAgICAgICBzY2FuZigiJWQiICwgYXJyICsgaSk7CiAgICB9CiAgICBwcmludGYoIiVkXG4iICwgc29sdmUoKSk7Cn0=