#include<iostream>
#include<cstdio>
#include<algorithm>
#define LL long long
using namespace std;
const int maxn = 1e5 + 10;
int n, ans, m;
int a[maxn];
LL sum[maxn];
int gcd(int, int);
int read();
int main() {
freopen("tarmy.in", "r", stdin);
freopen("tarmy.out", "w", stdout);
int i;
n = read(); m = read();
for(i = 1; i <= n; i++) {
a[i] = read();
sum[i] = sum[i - 1] + a[i];
}
int l = 1, r = 1;
while(r <= n) {
bool flag = true;
int sign = 0;
while(flag) {
r++;
for(i = r - 1; i >= l; i--) {
if(gcd(a[i], a[r]) != 1) {
sign = i;
flag = false;
break;
}
}
}
if(sum[r - 1] - sum[l - 1] >= m)
ans = max(ans, r - l);
l = sign + 1;
}
cout << ans << "\n";
return 0;
}
int gcd(int a, int b) {
return b == 0 ? a : gcd(b, a % b);
}
int read() {
char s = getchar();
int t = 0, f = 1;
while(!isdigit(s)) {
if(s == '-')f = -1;
s = getchar();
}
while(isdigit(s)) {
t = (t << 3) + (t << 1) + s - '0';
s = getchar();
}
return t*f;
}