from sys import stdin def main(): input = lambda: stdin.readline()[:-1] N, L = map(int, input().split()) if (N - 1) * 2 > L: print(0) return n = L // (N - 1) lst = primes235(n) cnt = 0 for i in lst: cnt += L - (N - 1) * i + 1 print(cnt) def primes235(limit): for i in (2, 3, 5): if limit >= i: yield i else: return modPrms = [7,11,13,17,19,23,29,31] gaps = [4,2,4,2,4,6,2,6,4,2,4,2,4,6,2,6] ndxs = [0,0,0,0,1,1,2,2,2,2,3,3,4,4,4,4,5,5,5,5,5,5,6,6,7,7,7,7,7,7] lmtbf = (limit + 23) // 30 * 8 - 1 lmtsqrt = (int(limit ** 0.5) - 7) lmtsqrt = lmtsqrt // 30 * 8 + ndxs[lmtsqrt % 30] buf = [True] * (lmtbf + 1) for i in range(lmtsqrt + 1): if buf[i]: ci = i & 7; p = 30 * (i >> 3) + modPrms[ci] s = p * p - 7; p8 = p << 3 for j in range(8): c = s // 30 * 8 + ndxs[s % 30] buf[c::p8] = [False] * ((lmtbf - c) // p8 + 1) s += p * gaps[ci]; ci += 1 for i in range(lmtbf - 6 + (ndxs[(limit - 7) % 30])): if buf[i]: yield (30 * (i >> 3) + modPrms[i & 7]) main()