#include <bits/stdc++.h>   using namespace std;   long long zero = 0;   long long fexp(long long a, long long b) {     long long ans = 1;     while (b) {       if (b & 1) ans = ans * a % 1000000007;       b /= 2;       a = a * a % 1000000007;     }     return ans;   }   long long multiply(long long a, long long b, long long mod) {     return ((a % mod) * (b % mod)) % mod;   }   template <typename ForwardIterator, typename T>   ForwardIterator first_less_than(ForwardIterator first, ForwardIterator last,                                   T value) {     auto it = std::lower_bound(first, last, value);     return (it == first ? last : --it);   }   void DFS(vector<int> adj[], int i, int visited[], long long c[],            long long *val) {     *val = min(*val, c[i]);     visited[i] = 1;     for (auto u : adj[i]) {       if (visited[u] == 0) DFS(adj, u, visited, c, val);     }   }   const int N = 1e5;   int visited[N];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     long long t;     t = 1;     while (t--) {       long long n, m;       cin >> n >> m;       long long a[N + 5];       if (m == 0) {         cout << n <<     << n;         return 0;       }       if (m == 1) {         cout << max(n - 2, (long long)0) <<     << n - 2;         return 0;       }       if (m == 2) {         cout << max(n - 4, (long long)0) <<     << n - 3;         return 0;       }       double u = sqrt(9 + (double)8 * m);       long long maxi = (3 + u) / 2;       long long mini = n - (2 * m);       for (long long i = 3; i < 1e5 + 1; i++) {         a[i] = (i * (i - 3)) / 2;         a[i] += i;       }       long long i = 3;       while (a[i] < m) i++;       cout << max(mini, (long long)0) <<     << n - i;     }     cerr <<  Time elapsed:   << clock() / (double)CLOCKS_PER_SEC << endl;     return 0;   }   