#include using namespace std; using ll = long long; using vb = vector; using vvb = vector; using vl = vector; using vvl = vector; #define REP(i,n) for(ll i = 0; i < (n); ++i) vb eratosthenes(ll n) { vb t(n + 1, true); t[0] = t[1] = false; for (ll i = 2; i <= n; ++i) if (t[i]) { for (ll j = 2 * i; j <= n; j += i) t[j] = false; } return t; } vl compress(const vb & t) { vl v; v.reserve((ll)(1.2 * t.size() / log(t.size()))); REP(i, t.size()) if (t[i]) v.push_back(i); return v; } int main() { cin.tie(0); ios_base::sync_with_stdio(false); cout << fixed << setprecision(50); ll n, l; cin >> n >> l; auto ps = compress(eratosthenes(l)); ll sum = 0; for (ll p : ps) { ll rest = l - p * (n - 1); if (rest < 0) break; sum += rest + 1; } cout << sum << endl; return 0; }