#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{ long long x, y; cin >> x >> y; long long sum = x + y; long long n = sqrt(2 * sum); cout << n; if (n * (n + 1) / 2 != sum) cout << -1 << endl; else { if (x <= n) cout << 1 << endl; else { int count = 0; int t = n; while (x > 0 && t > 0) { if (t <= x) { count += 1; x = x - t; } else { count += 1; break; } t--; } cout << count << endl; } } return 0;
}