#include <bits/stdc++.h>
using namespace std;
long long n, m, a, b, f;
int main() {
  cin >> n >> m;
  cout << max((long long)0, n - m * 2) << endl;
  for (int i = 0; i <= n; i++) {
    f = n - i;
    if ((f * (f - 1)) / 2 < m) {
      cout << i - 1;
      return 0;
    }
  }
  cout << n;
  return 0;
}
