#include <iostream>
#include <cstdio>
using namespace std;
typedef long long LL;
const int maxn = 1e6;
const int top = 2e5;
#define is_num(x) (x <= '9' and x >= '0')
inline LL get_num() {
char tmp = getchar();
int res = 0;
while (not is_num(tmp)) tmp = getchar();
while ( is_num(tmp)) {
res = (res << 3) + (res << 1) + tmp - '0';
tmp = getchar();
}
return res;
}
int prime[maxn], pcnt;
bool isn_prime[maxn];
inline void get_prime() {
for (int i = 2; i <= top; i++) {
if (not isn_prime[i]) prime[++pcnt] = i;
for (int j = 1; j <= pcnt and prime[j] * i <= top; j++) {
isn_prime[prime[j] * i] = true;
if (not (i % prime[j]))
break;
}
}
}
int s[maxn], n, k;
inline void read() {
scanf("%d %d", &n, &k);
for (int i = 1; i <= n; i++) s[i] = get_num();
}
int cnt_num[maxn];
int stop;
inline bool handle(int pos, bool dehandle = false) {
int num = s[pos];
bool is_ok = true;
for (int i = 1; prime[i] * prime[i] <= num and i <= pcnt and num != 1; i++) {
if (dehandle and cnt_num[prime[i]] == 2 and (not (num % prime[i]))) --stop;
if (not dehandle and cnt_num[prime[i]] == 1 and (not (num % prime[i]))) ++stop;
if (not (num % prime[i])) cnt_num[prime[i]] += dehandle ? -1 : 1;
while (not (num % prime[i])) num /= prime[i];
}
if (num != 1) {
if (dehandle and cnt_num[num] == 2) --stop;
if (not dehandle and cnt_num[num] == 1) ++stop;
cnt_num[num] += dehandle ? -1 : 1;
}
return stop == 0;
}
inline void solve() {
int l = 1, ans = 0;
long long now_sum = 0;
bool statu = false;
for (int i = 1; i <= n; i++) {
statu = handle(i);
now_sum += s[i];
while (not statu) now_sum -= s[l], statu = handle(l++, true);
if (statu and now_sum >= k) ans = max(ans, i - l + 1);
}
printf("%d\n", ans);
}
int main() {
freopen("tarmy.in", "r", stdin);
freopen("tarmy.out", "w", stdout);
read();
get_prime();
solve();
return 0;
}