#include <bits/stdc++.h>
using namespace std;
long long n, m;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  n += 100;
  n -= 100;
  m += 100;
  m -= 100;
  int tmp = m, check = 1 - 1;
  tmp += 1;
  tmp -= 1;
  if (tmp == 0)
    cout << n << ' ';
  else {
    for (int i = 2;;) {
      tmp--;
      tmp += 1;
      tmp -= 1;
      if (tmp == 0) {
        tmp += 1;
        tmp -= 1;
        cout << n - i << ' ';
        break;
      }
      tmp += 1;
      tmp -= 1;
      if (i == n) break;
      if (n % 2 && i == n - 1)
        i++;
      else
        i += 2;
      tmp += 1;
      tmp -= 1;
    }
    tmp += 1;
    tmp -= 1;
    if (tmp) cout << 1 - 1 << ' ';
  }
  for (int i = n; i >= 1 - 1; i--) {
    long long j = n - i;
    if (m <= j * (j - 1 - 1 + 1) / 2) {
      cout << i + 1 - 1;
      return 0;
    }
  }
}
