#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll sqr = 0;

int main() {
	cin.tie(0)->sync_with_stdio(0);

	ll N, K; cin >> N >> K;

	vector<int> seq(N);
	for (auto &i : seq) cin >> i;

	ll ans = 0;
	vector<ll> big(5 * 100000 + 1, 0);
	map<int, ll> small;

	ll dvojice = 0;
	int hi = 0;
	for (int lo = 0; lo < N; lo++) {
		while (hi < N) {
			for (int i = 1; i*i <= seq[hi]; i++) if (seq[hi] % i == 0) {
				if (i != 1) dvojice += big[i];
				if (i*i != seq[hi]) {
					dvojice += big[seq[hi]/i];
				}
			}

			for (auto [x, cnt] : small) {
				if (gcd(x, seq[hi]) > 1) {
					dvojice += cnt;
				}
			}

			if (seq[hi] < sqr) {
				small[seq[hi]] += 1;
			}else {
				for (int i = 1; i * seq[hi] < big.size(); i++) big[i*seq[hi]]++;
				for (int i = 2; i*i <= seq[hi];i++) if (seq[hi] % i == 0) {
					big[i]++;
					if (seq[hi]/i != i) big[seq[hi]/i]++;
				}
			}

			hi ++;


			if (dvojice >= K) break;
		}

		cerr << lo << " " << hi << " " << dvojice << endl;

		// upd ans
		if (dvojice >= K) {
			ans += N - hi + 1;
		}

		// remove lo
		if (seq[lo] < sqr) {
			small[seq[lo]]--;
			if (small[seq[lo]] == 0) small.erase(seq[lo]);
		} else {
			for (int i = 1; i * seq[lo] < big.size(); i++) big[i*seq[lo]]--;
			for (int i = 2; i*i <= seq[lo];i++) if (seq[lo] % i == 0) {
				big[i]--;
				if (seq[lo]/i != i) big[seq[lo]/i]--;
			}
		}

		// remove dvojice from lo
		for (int i = 1; i*i <= seq[lo]; i++) if (seq[lo] % i == 0) {
			dvojice -= big[i];
			if (i*i != seq[lo]) dvojice -= big[seq[lo]/i];
		}
		for (auto [x, cnt] : small) {
			if (gcd(x, seq[lo]) > 1) {
				dvojice -= cnt;
			}
		}

	}

	cout << ans << '\n';
}
