/*
 * File: TeachingHazard.cpp
 * Author: Magica
 * Date: 2014.08.25
 ****************************************/
#include <bits/stdc++.h>
using namespace std;
#define Multicase for (int TestCase = 1, TestCaseSum = xint(); TestCase <= TestCaseSum; ++TestCase)
#define __cin__ { cin.sync_with_stdio(0); cin.tie(0); }
#define inject(x) { cerr << "Function: " << __FUNCTION__ << ", Line: " << __LINE__ << ", " << #x << ": " << (x) << endl; }
#define mp make_pair
#define pb push_back
#define init(range, val) memset(range, val, sizeof(range))
typedef pair<int, int> pii;
typedef long long ll;
char buf;
inline char xchar() { while (buf = getchar(), isspace(buf)); return buf; }
inline int xint() { while (buf = getchar(), buf < '0' || buf > '9'); int x = buf - '0'; for (; buf = getchar(), buf >= '0' && buf <= '9'; x = x * 10 + buf - '0'); return x; }
inline ll xll() { while (buf = getchar(), buf < '0' || buf > '9'); ll x = buf - '0'; for (; buf = getchar(), buf >= '0' && buf <= '9'; x = x * 10 + buf - '0'); return x; }
inline string xstring() { while (buf = getchar(), buf == ' ' || buf == '\n'); string x = ""; for (x += buf; buf = getchar(), buf != ' ' && buf != '\n' && buf != '\r'; x += buf); return x; }
inline string xline() { while (buf = getchar(), buf == ' ' || buf == '\n'); string x = ""; for (x += buf; buf = getchar(), buf != '\n' && buf != '\r'; x += buf); return x; }
int Prime[10005], Cnt[10005], PSum = 0;
bool NoPrime[100005];
int main()
{
    int i, j, n, x;
    ll now, ls, ans;
    for (i = 2; i <= 100000; ++i) {
        if (!NoPrime[i])
            Prime[++PSum] = i;
        for (j = 1; j <= PSum && i * Prime[j] <= 100000; ++j) {
            NoPrime[i * Prime[j]] = true;
            if (i % Prime[j] == 0)
                break;
        }
    }
    while ((n = xint()) && (x = xint())) {
        ans = 0;
        init(Cnt, 0);
        for (i = 1; i <= PSum && Prime[i] <= n; ++i)
            for (now = Prime[i]; now <= n; now *= Prime[i])
                Cnt[i] += n / now;
        for (now = -1; now != 0; ++x) {
            ls = now;
            now = 1;
            for (i = 1; i <= PSum && Cnt[i] >= x; ++i)
                now *= Cnt[i] / x + 1;
            now -= 1;
            if (ls != -1)
                ans += (ls - now) * (ls - now - 1) >> 1;
        }
        printf("%lld\n", ans);
    }
    return 0;
}
