#include #include #include #include #include using namespace std; long long N, K, sum; vector> E; long long check(long long pos) { if (pos <= 1 || pos > 2LL * N) return 0LL; return N - abs(N + 1LL - pos); } int main() { cin >> N >> K; assert(1LL <= N && N <= 1000000000000LL); assert(1LL <= K && K <= 1000000000000LL); for (long long i = 1; i*i <= K; i++) { if (K%i != 0) continue; E.push_back(make_pair(i, K / i)); E.push_back(make_pair(K / i, i)); } sort(E.begin(), E.end()); E.erase(unique(E.begin(), E.end()), E.end()); for (int i = 0; i < E.size(); i++) { sum += check(E[i].first) * check(E[i].second); } cout << sum << endl; return 0; }