#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
int m, s;
string dfs(string x, int d, int sum) {
  if (d == m && s == sum) {
    return x;
  }
  if (d == m || d < m - 1 && (sum > s || sum + 9 * (m - d) < s)) {
    return "";
  }
  for (char c = (d == 1 ? '0' : x[d - 1]); c <= '9'; c++) {
    string res = dfs(x + c, d + 1, sum + c - '0');
    if (res != "") {
      return res;
    }
  }
  return "";
}
string rdfs(string x, int d, int sum) {
  if (d == m && s == sum) {
    return x;
  }
  if (d == m || d < m - 1 && (sum > s || sum + 9 * (m - d) < s)) {
    return "";
  }
  for (char c = x[d - 1]; c >= '0'; c--) {
    string res = rdfs(x + c, d + 1, sum + c - '0');
    if (res != "") {
      return res;
    }
  }
  return "";
}
int main() {
  cin >> m >> s;
  if (m == 1 && s < 10) {
    cout << s << " " << s << endl;
    return 0;
  }
  if (m > 1 && s == 0 || 9 * m < s) {
    cout << -1 << " " << -1 << endl;
    return 0;
  }
  string sres = "", lres = "";
  for (char c = '1'; c <= '9'; c++) {
    string x = "";
    x += c;
    x = dfs(x, 1, c - '0');
    if ((int)x.size() == m) {
      sres = x;
      break;
    }
  }
  for (char c = '9'; c >= '1'; c--) {
    string x = "";
    x += c;
    x = rdfs(x, 1, c - '0');
    if ((int)x.size() == m) {
      lres = x;
      break;
    }
  }
  if (sres != "") {
    cout << sres << " ";
  } else {
    cout << -1 << " ";
  }
  if (lres != "") {
    cout << lres << " ";
  } else {
    cout << -1 << " ";
  }
  return 0;
}
