#include <bits/stdc++.h>   using namespace std;   void small(long long m, long long s) {     vector<long long> v;     long long p = (s % 9 == 0) ? s / 9 - 1 : s / 9;     for (long long i = 0; i < p; i++) {       v.push_back(9);       s -= 9;     }     if (m - p == 1) {       v.push_back(s);     }     if (m - p >= 2) {       s--;       v.push_back(s);       for (long long i = 0; i < m - p - 2; i++) {         v.push_back(0);       }       v.push_back(1);     }     for (long long i = v.size() - 1; i >= 0; i--) {       cout << v[i];     }     cout <<    ;   }   void great(long long m, long long s) {     vector<long long> v;     long long k = s / 9;     for (long long i = 0; i < k; i++) {       v.push_back(9);       s -= 9;     }     if (s > 0) {       v.push_back(s);       k++;     }     for (long long i = 0; i < m - k; i++) {       v.push_back(0);     }     for (long long i = 0; i < v.size(); i++) {       cout << v[i];     }   }   int main() {     long long m, s, h;     string k;     vector<int> v;     cin >> m >> s;     if (s % 9 == 0) {       long long t = 0;       if (m == 1 && s == 0) {         cout <<  0                <<  0 ;         t = 1;       }       if (t == 0) {         if (m < s / 9 || s == 0) {           cout <<  -1                  <<  -1 ;         } else {           small(m, s);           great(m, s);         }       }     } else if (s % 9 != 0) {       long long t = 0;       if (m == 1 && s == 0) {         cout <<  0                <<  0 ;         t = 1;       }       if (t == 0) {         if (m < s / 9 + 1 || s == 0) {           cout <<  -1                  <<  -1 ;         } else {           small(m, s);           great(m, s);         }       }     }     return 0;   }   