#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int t = m;
  int t1 = n;
  vector<int> a;
  vector<int> b;
  if ((m == 0 and n != 1) or n * 9 < m) {
    cout << -1 << " " << -1;
  } else {
    if (n == 1) {
      cout << m << " " << m;
    } else {
      while (m - 9 > 0) {
        b.push_back(9);
        m -= 9;
        n -= 1;
      }
      if (n != 1) {
        b.push_back(m - 1);
      } else {
        b.push_back(m);
      }
      n -= 1;
      for (int i = 0; i < n - 1; ++i) {
        b.push_back(0);
      }
      if (n > 0) {
        b.push_back(1);
      }
      n = b.size();
      for (int i = 0; i < n; ++i) {
        cout << b[n - i - 1];
      }
      cout << " ";
      m = t;
      n = t1;
      while (m - 9 > 0) {
        a.push_back(9);
        m -= 9;
        n -= 1;
      }
      a.push_back(m);
      n -= 1;
      for (int i = 0; i < n; ++i) {
        a.push_back(0);
      }
      n = a.size();
      for (int i = 0; i < n; ++i) {
        cout << a[i];
      }
    }
  }
}
