#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long m, s;
  cin >> m >> s;
  if (s == 0 && m > 1)
    cout << -1 << " -1";
  else if (m * 9 < s) {
    cout << "-1 -1";
  } else {
    long long c = 0, s1 = s;
    vector<long long> q;
    for (long long i = 0; i < m; ++i) {
      if (s > 9) {
        q.push_back(9);
        s -= 9;
      } else if (s > 1) {
        if (i == m - 1) {
          q.push_back(s);
          s = 0;
        } else {
          q.push_back(s - 1);
          s = 1;
        }
      } else if (s == 1 && i == m - 1) {
        q.push_back(1);
        s--;
      } else {
        q.push_back(0);
      }
    }
    for (long long i = 0; i < m; ++i) {
      cout << q[m - i - 1];
    }
    cout << " ";
    s = s1;
    for (long long i = 0; i < m; ++i) {
      if (s >= 9) {
        cout << 9;
        s -= 9;
      } else if (s) {
        cout << s;
        s = 0;
      } else
        cout << 0;
    }
  }
  return 0;
}
